Public Member Functions | Public Attributes | Protected Attributes | List of all members
WireCell::LinearModel Class Reference

#include <LinearModel.h>

Inheritance diagram for WireCell::LinearModel:
WireCell::ElasticNetModel WireCell::LassoModel

Public Member Functions

 LinearModel ()
 
virtual ~LinearModel ()
 
Eigen::VectorXd & Gety ()
 
Eigen::MatrixXd & GetX ()
 
Eigen::VectorXd & Getbeta ()
 
virtual void SetData (Eigen::MatrixXd X, Eigen::VectorXd y)
 
virtual void Sety (Eigen::VectorXd y)
 
virtual void SetX (Eigen::MatrixXd X)
 
virtual void Setbeta (Eigen::VectorXd beta)
 
virtual void Fit ()
 
Eigen::VectorXd Predict ()
 
double chi2_base ()
 
double MeanResidual ()
 

Public Attributes

std::string name
 

Protected Attributes

Eigen::VectorXd _y
 
Eigen::MatrixXd _X
 
Eigen::VectorXd _beta
 

Detailed Description

Definition at line 9 of file LinearModel.h.

Constructor & Destructor Documentation

WireCell::LinearModel::LinearModel ( )

Definition at line 6 of file LinearModel.cxx.

7 {}
WireCell::LinearModel::~LinearModel ( )
virtual

Definition at line 9 of file LinearModel.cxx.

10 {}

Member Function Documentation

double WireCell::LinearModel::chi2_base ( )

Definition at line 17 of file LinearModel.cxx.

18 {
19  return ( _y - Predict() ).squaredNorm();
20 }
Eigen::VectorXd Predict()
Definition: LinearModel.cxx:12
Eigen::VectorXd _y
Definition: LinearModel.h:32
virtual void WireCell::LinearModel::Fit ( )
inlinevirtual

Reimplemented in WireCell::ElasticNetModel, and WireCell::LassoModel.

Definition at line 23 of file LinearModel.h.

23 {};
Eigen::VectorXd& WireCell::LinearModel::Getbeta ( )
inline

Definition at line 16 of file LinearModel.h.

16 { return _beta; }
Eigen::VectorXd _beta
Definition: LinearModel.h:34
Eigen::MatrixXd& WireCell::LinearModel::GetX ( )
inline

Definition at line 15 of file LinearModel.h.

15 { return _X; }
Eigen::MatrixXd _X
Definition: LinearModel.h:33
Eigen::VectorXd& WireCell::LinearModel::Gety ( )
inline

Definition at line 14 of file LinearModel.h.

14 { return _y; }
Eigen::VectorXd _y
Definition: LinearModel.h:32
double WireCell::LinearModel::MeanResidual ( )

Definition at line 23 of file LinearModel.cxx.

24 {
25  return ( _y - Predict() ).norm() / _y.size();
26 }
Eigen::VectorXd Predict()
Definition: LinearModel.cxx:12
Eigen::VectorXd _y
Definition: LinearModel.h:32
VectorXd WireCell::LinearModel::Predict ( )

Definition at line 12 of file LinearModel.cxx.

13 {
14  return _X * _beta;
15 }
Eigen::MatrixXd _X
Definition: LinearModel.h:33
Eigen::VectorXd _beta
Definition: LinearModel.h:34
virtual void WireCell::LinearModel::Setbeta ( Eigen::VectorXd  beta)
inlinevirtual

Definition at line 21 of file LinearModel.h.

21 { _beta = beta; }
Eigen::VectorXd _beta
Definition: LinearModel.h:34
virtual void WireCell::LinearModel::SetData ( Eigen::MatrixXd  X,
Eigen::VectorXd  y 
)
inlinevirtual

Definition at line 18 of file LinearModel.h.

18 { SetX(X); Sety(y); }
virtual void SetX(Eigen::MatrixXd X)
Definition: LinearModel.h:20
double y
virtual void Sety(Eigen::VectorXd y)
Definition: LinearModel.h:19
virtual void WireCell::LinearModel::SetX ( Eigen::MatrixXd  X)
inlinevirtual

Reimplemented in WireCell::ElasticNetModel.

Definition at line 20 of file LinearModel.h.

20 { _X = X; _beta = Eigen::VectorXd::Zero(X.cols());}
Eigen::MatrixXd _X
Definition: LinearModel.h:33
Eigen::VectorXd _beta
Definition: LinearModel.h:34
virtual void WireCell::LinearModel::Sety ( Eigen::VectorXd  y)
inlinevirtual

Definition at line 19 of file LinearModel.h.

19 { _y = y; }
double y
Eigen::VectorXd _y
Definition: LinearModel.h:32

Member Data Documentation

Eigen::VectorXd WireCell::LinearModel::_beta
protected

Definition at line 34 of file LinearModel.h.

Eigen::MatrixXd WireCell::LinearModel::_X
protected

Definition at line 33 of file LinearModel.h.

Eigen::VectorXd WireCell::LinearModel::_y
protected

Definition at line 32 of file LinearModel.h.

std::string WireCell::LinearModel::name

Definition at line 27 of file LinearModel.h.


The documentation for this class was generated from the following files: