|
Cosan
1.0
Data Analytics Library
|
Go to the documentation of this file.
5 #ifndef COSAN_COSANRIDGEREGRESSION_H
6 #define COSAN_COSANRIDGEREGRESSION_H
17 template<Numeric NumericType>
53 const std::string
GetName()
const override{
return "Linear Ridge Regression";}
59 if (this->
MBias==
true){
60 X.conservativeResize(X.rows(), X.cols()+1);
62 Identity.conservativeResize(Identity.rows()+1, Identity.cols()+1);
71 this->
MBeta = (X.transpose()*X+Identity).ldlt().solve(X.transpose()*Y);
74 if (this->
MBias==
true){
84 #endif //COSAN_COSANRIDGEREGRESSION_H
CosanMatrix< NumericType > GetInput()
Get a copy of CosanMatrix<NumericType> X.
CosanMatrix< NumericType > GetTarget()
Get a copy of CosanMatrix<NumericType> Y.
const std::string GetName() const override
Get the name of the objects.
CosanRidgeRegression(NumericType Lambda, bool bias=false)
CosanRidgeRegression(bool bias=false)
void SetParams(NumericType Lambda)
Eigen::Matrix< NumericType, Eigen::Dynamic, Eigen::Dynamic > CosanMatrix
CosanMatrix< NumericType > MBeta
CosanLinear Model. All linear model inherit this object.
CosanRidgeRegression(T &&X, const CosanMatrix< NumericType > &Y, NumericType Lambda, bool Bias)
CosanRidgeRegression(CosanRawData< NumericType > &RD, bool bias=false)
CosanRidgeRegression(CosanData< NumericType > &CD, bool bias=false)
void removeColumn(Matrix &matrix, gsl::index colToRemove)
void fit(T &&X, const CosanMatrix< NumericType > &Y)
EModelType GetModelType() override