yat/regression/PolynomialWeighted.h

Code
Comments
Other
Rev Date Author Line
681 11 Oct 06 jari 1 #ifndef _theplu_yat_regression_polynomialweighted_
681 11 Oct 06 jari 2 #define _theplu_yat_regression_polynomialweighted_
586 19 Jun 06 peter 3
616 31 Aug 06 jari 4 // $Id$
616 31 Aug 06 jari 5
675 10 Oct 06 jari 6 /*
4359 23 Aug 23 peter 7   Copyright (C) 2006 Jari Häkkinen, Peter Johansson
4359 23 Aug 23 peter 8   Copyright (C) 2007 Peter Johansson
4359 23 Aug 23 peter 9   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
586 19 Jun 06 peter 10
1437 25 Aug 08 peter 11   This file is part of the yat library, http://dev.thep.lu.se/yat
586 19 Jun 06 peter 12
675 10 Oct 06 jari 13   The yat library is free software; you can redistribute it and/or
675 10 Oct 06 jari 14   modify it under the terms of the GNU General Public License as
1486 09 Sep 08 jari 15   published by the Free Software Foundation; either version 3 of the
675 10 Oct 06 jari 16   License, or (at your option) any later version.
586 19 Jun 06 peter 17
675 10 Oct 06 jari 18   The yat library is distributed in the hope that it will be useful,
675 10 Oct 06 jari 19   but WITHOUT ANY WARRANTY; without even the implied warranty of
675 10 Oct 06 jari 20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
675 10 Oct 06 jari 21   General Public License for more details.
675 10 Oct 06 jari 22
675 10 Oct 06 jari 23   You should have received a copy of the GNU General Public License
1487 10 Sep 08 jari 24   along with yat. If not, see <http://www.gnu.org/licenses/>.
675 10 Oct 06 jari 25 */
675 10 Oct 06 jari 26
680 11 Oct 06 jari 27 #include "OneDimensionalWeighted.h"
680 11 Oct 06 jari 28 #include "MultiDimensionalWeighted.h"
1120 21 Feb 08 peter 29 #include "yat/utility/Vector.h"
675 10 Oct 06 jari 30
586 19 Jun 06 peter 31 namespace theplu {
680 11 Oct 06 jari 32 namespace yat {
586 19 Jun 06 peter 33 namespace regression {
586 19 Jun 06 peter 34
586 19 Jun 06 peter 35   ///
767 22 Feb 07 peter 36   /// @brief Polynomial Regression in weighted fashion.
586 19 Jun 06 peter 37   ///
586 19 Jun 06 peter 38   class PolynomialWeighted : public OneDimensionalWeighted
586 19 Jun 06 peter 39   {
586 19 Jun 06 peter 40   public:
586 19 Jun 06 peter 41
586 19 Jun 06 peter 42     ///
648 14 Sep 06 peter 43     /// @param power degree of polynomial model
586 19 Jun 06 peter 44     ///
703 18 Dec 06 jari 45     PolynomialWeighted(size_t power);
586 19 Jun 06 peter 46
586 19 Jun 06 peter 47     ///
586 19 Jun 06 peter 48     /// @brief Destructor
586 19 Jun 06 peter 49     ///
703 18 Dec 06 jari 50     ~PolynomialWeighted(void);
586 19 Jun 06 peter 51
586 19 Jun 06 peter 52     ///
586 19 Jun 06 peter 53     /// This function computes the best-fit given the polynomial model
586 19 Jun 06 peter 54     /// model by minimizing \f$ \sum{w_i(\hat{y_i}-y_i)^2} \f$, where
586 19 Jun 06 peter 55     /// \f$ \hat{y} \f$ is the fitted value. The weight \f$ w_i \f$
586 19 Jun 06 peter 56     /// should be proportional to the inverse of the variance for \f$
586 19 Jun 06 peter 57     /// y_i \f$
586 19 Jun 06 peter 58     ///
1020 01 Feb 08 peter 59     void fit(const utility::VectorBase& x, const utility::VectorBase& y,
1020 01 Feb 08 peter 60              const utility::VectorBase& w);
586 19 Jun 06 peter 61
586 19 Jun 06 peter 62     ///
740 12 Jan 07 peter 63     /// @return parameters of the model
740 12 Jan 07 peter 64     ///
740 12 Jan 07 peter 65     /// @see MultiDimensional
740 12 Jan 07 peter 66     ///
1120 21 Feb 08 peter 67     const utility::Vector& fit_parameters(void) const;
740 12 Jan 07 peter 68
740 12 Jan 07 peter 69     ///
702 26 Oct 06 peter 70     /// @brief Mean Squared Error
702 26 Oct 06 peter 71     ///
742 13 Jan 07 peter 72     double s2(const double w=1) const;
702 26 Oct 06 peter 73
702 26 Oct 06 peter 74     ///
4200 19 Aug 22 peter 75     /// function predicting in one point.
586 19 Jun 06 peter 76     ///
586 19 Jun 06 peter 77     double predict(const double x) const;
586 19 Jun 06 peter 78
586 19 Jun 06 peter 79     ///
586 19 Jun 06 peter 80     /// @return error of model value in @a x
586 19 Jun 06 peter 81     ///
729 05 Jan 07 peter 82     double standard_error2(const double x) const;
586 19 Jun 06 peter 83
586 19 Jun 06 peter 84   private:
586 19 Jun 06 peter 85     MultiDimensionalWeighted md_;
586 19 Jun 06 peter 86     size_t power_;
586 19 Jun 06 peter 87
586 19 Jun 06 peter 88   };
586 19 Jun 06 peter 89
681 11 Oct 06 jari 90 }}} // of namespaces regression, yat, and theplu
586 19 Jun 06 peter 91
586 19 Jun 06 peter 92 #endif