STK++ 1.0
STK_AdditiveBSplineRegression.h
Go to the documentation of this file.
00001 /*--------------------------------------------------------------------*/
00002 /*     Copyright (C) 2004-2010  Serge Iovleff
00003 
00004  This program is free software; you can redistribute it and/or modify
00005  it under the terms of the GNU Lesser General Public License as
00006  published by the Free Software Foundation; either version 2 of the
00007  License, or (at your option) any later version.
00008 
00009  This program is distributed in the hope that it will be useful,
00010  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  GNU Lesser General Public License for more details.
00013 
00014  You should have received a copy of the GNU Lesser General Public
00015  License along with this program; if not, write to the
00016  Free Software Foundation, Inc.,
00017  59 Temple Place,
00018  Suite 330,
00019  Boston, MA 02111-1307
00020  USA
00021 
00022  Contact : Serge.Iovleff@stkpp.org
00023  */
00024 
00025 /*
00026  * Project:  stkpp::Regress
00027  * created on: 31 juil. 2010
00028  * Purpose: definition of the AdditiveBSplineRegression class.
00029  * Author:   iovleff, serge.iovleff@stkpp.org
00030  **/
00031 
00036 #ifndef STK_ADDITIVEBSPLINEREGRESSION_H
00037 #define STK_ADDITIVEBSPLINEREGRESSION_H
00038 
00039 #include "STK_IRegression.h"
00040 #include "STK_AdditiveBSplineCoefficients.h"
00041 
00042 namespace STK
00043 {
00044 
00049 class AdditiveBSplineRegression : public IRegression<Matrix, Matrix, Vector>
00050 {
00051   private:
00052     typedef BSplineCoefficients::KnotsPosition _Kposition;
00053 
00054   public:
00062     AdditiveBSplineRegression( Matrix const* p_y
00063                              , Matrix const* p_x
00064                              , Integer const& nbControlPoints
00065                              , Integer const& degree = 3
00066                              , _Kposition const& position = BSplineCoefficients::uniform_
00067                              );
00068 
00070     virtual ~AdditiveBSplineRegression();
00071 
00075     inline Integer const& degree() const
00076     { return degree_;}
00080     inline Integer const& nbControlPoints() const
00081     { return nbControlPoints_;}
00085     inline Matrix const& controlPoints() const
00086     { return controlPoints_; }
00091     inline Matrix const& coefficients() const
00092     { return coefs_.coefficients();}
00093 
00094   protected:
00096     Integer nbControlPoints_;
00098     Integer degree_;
00100     _Kposition position_;
00102     AdditiveBSplineCoefficients coefs_;
00104     Matrix controlPoints_;
00105 
00109     virtual void preRun();
00110 
00112     virtual void regression();
00116     virtual void regression(Vector const& weights);
00118     virtual void prediction();
00122     inline virtual Integer computeNbParameter() const
00123     { return controlPoints_.sizeHo() * controlPoints_.sizeVe(); }
00124 };
00125 
00126 } // namespace STK
00127 
00128 #endif /* STK_ADDITIVEBSPLINEREGRESSION_H */