STK++ 1.0
STK_BSplineRegression.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 BsplineRegression class.
00029  * Author:   iovleff, serge.iovleff@stkpp.org
00030  **/
00031 
00036 #ifndef STK_BSPLINEREGRESSION_H
00037 #define STK_BSPLINEREGRESSION_H
00038 
00039 #include "../../Arrays/include/STK_Matrix.h"
00040 
00041 #include "STK_BSplineCoefficients.h"
00042 #include "STK_IRegression.h"
00043 
00044 namespace STK
00045 {
00046 
00051 class BSplineRegression : public IRegression<Matrix, Vector, Vector>
00052 {
00053   private:
00054     typedef BSplineCoefficients::KnotsPosition _Kposition;
00055 
00056   public:
00064     BSplineRegression( Matrix const* p_y
00065                      , Vector const* p_x
00066                      , Integer const& nbControlPoints
00067                      , Integer const& degree = 3
00068                      , const _Kposition& position = BSplineCoefficients::uniform_
00069                      );
00070 
00072     virtual ~BSplineRegression();
00073 
00077     inline Integer const& degree() const
00078     { return degree_;}
00082     inline Integer const& nbControlPoints() const
00083     { return nbControlPoints_;}
00087     inline Matrix const& controlPoints() const
00088     { return controlPoints_; }
00092     inline Vector const& knots() const
00093     { return coefs_.knots(); }
00098     inline Matrix const& coefficients() const
00099     { return coefs_.coefficients();}
00100 
00101   protected:
00103     Integer nbControlPoints_;
00105     Integer degree_;
00107     _Kposition position_;
00109     BSplineCoefficients coefs_;
00111     Matrix controlPoints_;
00112 
00116     inline virtual void preRun() {coefs_.run();}
00117 
00121     virtual void regression();
00126     virtual void regression(Vector const& weights);
00130     virtual void prediction();
00134     inline virtual Integer computeNbParameter() const
00135     { return controlPoints_.sizeHo() * controlPoints_.sizeVe(); }
00136 
00137 };
00138 
00139 } // namespace STK
00140 
00141 #endif /* STK_BSPLINEREGRESSION_H */