mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends
m::LinearModel Class Reference

A model for predicting the costs of a physical operator. More...

#include <LinearModel.hpp>

Collaboration diagram for m::LinearModel:
[legend]

Public Member Functions

 LinearModel (Eigen::VectorXd coefficientVector)
 Create a LinearModel instance given a coefficient vector.
 
 LinearModel (Eigen::VectorXd coefficientVector, unsigned numFeatures, std::function< Eigen::MatrixXd(Eigen::MatrixXd)> transform_function)
 Create a LinearModel instance given a coefficient vector, a transformation function and the number of expected features.
 
 LinearModel (const Eigen::MatrixXd &X, const Eigen::VectorXd &y)
 Create a LinearModel instance by linear regression given a feature maxtrix X containing training data of the features and target vector y containing expected values for the features in X.
 
 LinearModel (const Eigen::MatrixXd &X, const Eigen::VectorXd &y, const std::function< Eigen::MatrixXd(Eigen::MatrixXd)> &transform_function)
 Create a LinearModel instance by linear regression given a feature maxtrix X containing training data of the features, target vector y containing expected values for the features in X and a transformation function for the features.
 
double predict_target (const Eigen::RowVectorXd &feature_vector) const
 
Eigen::VectorXd get_coefficients () const
 
void dump (std::ostream &out) const
 
void dump () const
 

Private Attributes

Eigen::VectorXd coefficients_
 vector of coefficients for every feature
 
std::function< Eigen::MatrixXd(Eigen::MatrixXd)> transformation_
 transformation that is applied on the feature matrix
 
unsigned num_features_
 number of features this model expects pre-transformation
 

Friends

std::ostream & operator<< (std::ostream &out, const LinearModel &linear_model)
 

Detailed Description

A model for predicting the costs of a physical operator.

Definition at line 11 of file LinearModel.hpp.

Constructor & Destructor Documentation

◆ LinearModel() [1/4]

m::LinearModel::LinearModel ( Eigen::VectorXd  coefficientVector)
inlineexplicit

Create a LinearModel instance given a coefficient vector.

Definition at line 20 of file LinearModel.hpp.

◆ LinearModel() [2/4]

m::LinearModel::LinearModel ( Eigen::VectorXd  coefficientVector,
unsigned  numFeatures,
std::function< Eigen::MatrixXd(Eigen::MatrixXd)>  transform_function 
)
inlineexplicit

Create a LinearModel instance given a coefficient vector, a transformation function and the number of expected features.

Definition at line 25 of file LinearModel.hpp.

◆ LinearModel() [3/4]

LinearModel::LinearModel ( const Eigen::MatrixXd &  X,
const Eigen::VectorXd &  y 
)

Create a LinearModel instance by linear regression given a feature maxtrix X containing training data of the features and target vector y containing expected values for the features in X.

Definition at line 15 of file LinearModel.cpp.

◆ LinearModel() [4/4]

LinearModel::LinearModel ( const Eigen::MatrixXd &  X,
const Eigen::VectorXd &  y,
const std::function< Eigen::MatrixXd(Eigen::MatrixXd)> &  transform_function 
)

Create a LinearModel instance by linear regression given a feature maxtrix X containing training data of the features, target vector y containing expected values for the features in X and a transformation function for the features.

Definition at line 18 of file LinearModel.cpp.

References coefficients_, num_features_, m::regression_linear_closed_form(), transformation_, and m::X.

Member Function Documentation

◆ dump() [1/2]

void LinearModel::dump ( ) const

Definition at line 63 of file LinearModel.cpp.

References dump().

Referenced by dump().

◆ dump() [2/2]

void LinearModel::dump ( std::ostream &  out) const

Definition at line 57 of file LinearModel.cpp.

◆ get_coefficients()

Eigen::VectorXd m::LinearModel::get_coefficients ( ) const
inline

◆ predict_target()

double LinearModel::predict_target ( const Eigen::RowVectorXd &  feature_vector) const

Definition at line 29 of file LinearModel.cpp.

References m::and, coefficients_, M_insist, num_features_, and transformation_.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const LinearModel linear_model 
)
friend

Field Documentation

◆ coefficients_

Eigen::VectorXd m::LinearModel::coefficients_
private

vector of coefficients for every feature

Definition at line 13 of file LinearModel.hpp.

Referenced by LinearModel(), and predict_target().

◆ num_features_

unsigned m::LinearModel::num_features_
private

number of features this model expects pre-transformation

Definition at line 16 of file LinearModel.hpp.

Referenced by LinearModel(), and predict_target().

◆ transformation_

std::function<Eigen::MatrixXd(Eigen::MatrixXd)> m::LinearModel::transformation_
private

transformation that is applied on the feature matrix

Definition at line 15 of file LinearModel.hpp.

Referenced by LinearModel(), and predict_target().


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