15 #ifndef MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP 16 #define MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP 21 namespace regression {
116 const bool scaleData =
false,
117 const size_t maxIterations = 50,
118 const double tolerance = 1e-4);
130 const arma::rowvec& responses);
140 void Predict(
const arma::mat& points,
141 arma::rowvec& predictions)
const;
153 void Predict(
const arma::mat& points,
154 arma::rowvec& predictions,
155 arma::rowvec&
std)
const;
165 double RMSE(
const arma::mat& data,
166 const arma::rowvec& responses)
const;
173 const arma::colvec&
Omega()
const {
return omega; }
181 double Alpha()
const {
return alpha; }
189 double Beta()
const {
return beta; }
203 const arma::colvec&
DataOffset()
const {
return dataOffset; }
211 const arma::colvec&
DataScale()
const {
return dataScale; }
245 template<
typename Archive>
246 void serialize(Archive& ar,
const uint32_t version);
256 size_t maxIterations;
262 arma::colvec dataOffset;
265 arma::colvec dataScale;
268 double responsesOffset;
283 arma::mat matCovariance;
295 double CenterScaleData(
const arma::mat& data,
296 const arma::rowvec& responses,
298 arma::rowvec& responsesProc);
306 void CenterScaleDataPred(
const arma::mat& data,
307 arma::mat& dataProc)
const;
const arma::colvec & Omega() const
Get the solution vector.
Definition: bayesian_linear_regression.hpp:173
void Predict(const arma::mat &points, arma::rowvec &predictions) const
Predict for each data point in the given data matrix using the currently-trained Bayesian Ridge mode...
Definition: bayesian_linear_regression.cpp:93
double Train(const arma::mat &data, const arma::rowvec &responses)
Run BayesianLinearRegression.
Definition: bayesian_linear_regression.cpp:33
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
bool CenterData() const
Get whether the data will be centered during training.
Definition: bayesian_linear_regression.hpp:221
The core includes that mlpack expects; standard C++ includes and Armadillo.
const arma::colvec & DataOffset() const
Get the mean vector computed on the features over the training points.
Definition: bayesian_linear_regression.hpp:203
Definition: pointer_wrapper.hpp:23
double Alpha() const
Get the precision (or inverse variance) of the gaussian prior.
Definition: bayesian_linear_regression.hpp:181
size_t MaxIterations() const
Get the maximum number of iterations for training.
Definition: bayesian_linear_regression.hpp:233
const arma::colvec & DataScale() const
Get the vector of standard deviations computed on the features over the training points.
Definition: bayesian_linear_regression.hpp:211
double RMSE(const arma::mat &data, const arma::rowvec &responses) const
Compute the Root Mean Square Error between the predictions returned by the model and the true respons...
Definition: bayesian_linear_regression.cpp:114
BayesianLinearRegression(const bool centerData=true, const bool scaleData=false, const size_t maxIterations=50, const double tolerance=1e-4)
Set the parameters of Bayesian Ridge regression object.
Definition: bayesian_linear_regression.cpp:19
void serialize(Archive &ar, const uint32_t version)
Serialize the BayesianLinearRegression model.
Definition: bayesian_linear_regression_impl.hpp:24
double Variance() const
Get the estimated variance.
Definition: bayesian_linear_regression.hpp:196
A Bayesian approach to the maximum likelihood estimation of the parameters of the linear regression ...
Definition: bayesian_linear_regression.hpp:99
size_t & MaxIterations()
Modify the maximum number of iterations for training.
Definition: bayesian_linear_regression.hpp:235
double Tolerance() const
Get the tolerance for training to converge.
Definition: bayesian_linear_regression.hpp:238
bool & ScaleData()
Modify whether the data will be scaled by standard deviations during training.
Definition: bayesian_linear_regression.hpp:230
double Beta() const
Get the precision (or inverse variance) beta of the model.
Definition: bayesian_linear_regression.hpp:189
bool & CenterData()
Modify whether the data will be centered during training.
Definition: bayesian_linear_regression.hpp:223
double ResponsesOffset() const
Get the mean value of the train responses.
Definition: bayesian_linear_regression.hpp:218
bool ScaleData() const
Get whether the data will be scaled by standard deviations during training.
Definition: bayesian_linear_regression.hpp:227
double & Tolerance()
Modify the tolerance for training to converge.
Definition: bayesian_linear_regression.hpp:240