yat/regression/Multivariate.h

Code
Comments
Other
Rev Date Author Line
3614 06 Feb 17 peter 1 #ifndef theplu_yat_regression_multivariate
3614 06 Feb 17 peter 2 #define theplu_yat_regression_multivariate
3614 06 Feb 17 peter 3
3614 06 Feb 17 peter 4 // $Id$
3614 06 Feb 17 peter 5
3614 06 Feb 17 peter 6 /*
4207 26 Aug 22 peter 7   Copyright (C) 2017, 2021, 2022 Peter Johansson
3614 06 Feb 17 peter 8
3614 06 Feb 17 peter 9   This file is part of the yat library, http://dev.thep.lu.se/yat
3614 06 Feb 17 peter 10
3614 06 Feb 17 peter 11   The yat library is free software; you can redistribute it and/or
3614 06 Feb 17 peter 12   modify it under the terms of the GNU General Public License as
3614 06 Feb 17 peter 13   published by the Free Software Foundation; either version 3 of the
3614 06 Feb 17 peter 14   License, or (at your option) any later version.
3614 06 Feb 17 peter 15
3614 06 Feb 17 peter 16   The yat library is distributed in the hope that it will be useful,
3614 06 Feb 17 peter 17   but WITHOUT ANY WARRANTY; without even the implied warranty of
3614 06 Feb 17 peter 18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3614 06 Feb 17 peter 19   General Public License for more details.
3614 06 Feb 17 peter 20
3614 06 Feb 17 peter 21   You should have received a copy of the GNU General Public License
3614 06 Feb 17 peter 22   along with yat. If not, see <http://www.gnu.org/licenses/>.
3614 06 Feb 17 peter 23 */
3614 06 Feb 17 peter 24
3614 06 Feb 17 peter 25 namespace theplu {
3614 06 Feb 17 peter 26 namespace yat {
3614 06 Feb 17 peter 27 namespace utility {
3614 06 Feb 17 peter 28   class Matrix;
4130 20 Jan 22 peter 29   class MatrixBase;
3614 06 Feb 17 peter 30   class Vector;
3614 06 Feb 17 peter 31   class VectorBase;
3614 06 Feb 17 peter 32 }
3614 06 Feb 17 peter 33 namespace regression {
3614 06 Feb 17 peter 34
3614 06 Feb 17 peter 35   /**
4095 16 Sep 21 peter 36      The name of this class is a bit a misnomer; a better name would
4095 16 Sep 21 peter 37      be Multivariable. It defines the interface for multivariable
4095 16 Sep 21 peter 38      regression classes, i.e., \f$ x \f$ is a vector in the
4095 16 Sep 21 peter 39      general model \f$ y = f(x) \f$.
3614 06 Feb 17 peter 40
3614 06 Feb 17 peter 41      \since new in yat 0.15
3614 06 Feb 17 peter 42    */
3614 06 Feb 17 peter 43   class Multivariate
3614 06 Feb 17 peter 44   {
3614 06 Feb 17 peter 45   public:
3614 06 Feb 17 peter 46     /**
3614 06 Feb 17 peter 47        \brief destructor
3614 06 Feb 17 peter 48      */
3614 06 Feb 17 peter 49     virtual ~Multivariate(void);
3614 06 Feb 17 peter 50
3614 06 Feb 17 peter 51     /**
4130 20 Jan 22 peter 52        This is the old interface before MatrixBase was introduced and
4130 20 Jan 22 peter 53        is only kept not to break compatibility with older code. This
4130 20 Jan 22 peter 54        function should have the same behaviour as the fit2 function
4130 20 Jan 22 peter 55        and typically it's implemented with a direct call two fit2.
4130 20 Jan 22 peter 56      */
4130 20 Jan 22 peter 57     virtual void fit(const utility::Matrix& x, const utility::VectorBase& y)=0;
4130 20 Jan 22 peter 58
4130 20 Jan 22 peter 59     /**
3614 06 Feb 17 peter 60        Estimating model parameters based on \a X to fit output data \a
3614 06 Feb 17 peter 61        y. Each row in \a X corresponds to one data point, i.e., number
3614 06 Feb 17 peter 62        of rows in \a X must match size of \a y.
4130 20 Jan 22 peter 63
4130 20 Jan 22 peter 64        A default implementation (relying on function fit()) is
4130 20 Jan 22 peter 65        provided just to not break older code. The implementation
4130 20 Jan 22 peter 66        involves a copying of the input matrix and classes inheriting
4130 20 Jan 22 peter 67        from Multivariate should this preferably implement this
4130 20 Jan 22 peter 68        function to avoid that copying.
4130 20 Jan 22 peter 69
4130 20 Jan 22 peter 70        \since New in yat 0.20
3614 06 Feb 17 peter 71      */
4130 20 Jan 22 peter 72     virtual void fit2(const utility::MatrixBase& x,
4130 20 Jan 22 peter 73                       const utility::VectorBase& y);
3614 06 Feb 17 peter 74
3614 06 Feb 17 peter 75     /**
3614 06 Feb 17 peter 76        \return parameters of the model
3614 06 Feb 17 peter 77      */
3614 06 Feb 17 peter 78     virtual const utility::Vector& fit_parameters(void) const=0;
3614 06 Feb 17 peter 79
3614 06 Feb 17 peter 80     /**
3614 06 Feb 17 peter 81        \brief predict value in \a x according to model
3614 06 Feb 17 peter 82      */
3614 06 Feb 17 peter 83     virtual double predict(const utility::VectorBase& x) const=0;
3614 06 Feb 17 peter 84   };
3614 06 Feb 17 peter 85
3614 06 Feb 17 peter 86 }}}
3614 06 Feb 17 peter 87
3614 06 Feb 17 peter 88 #endif