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);
129 double Train(
const arma::mat& data,
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;
313 #include "bayesian_linear_regression_impl.hpp" double Tolerance() const
Get the tolerance for training to converge.
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...
const arma::colvec & Omega() const
Get the solution vector.
double Variance() const
Get the estimated variance.
Linear algebra utility functions, generally performed on matrices or vectors.
void serialize(Archive &ar, const uint32_t version)
Serialize the BayesianLinearRegression model.
bool & ScaleData()
Modify whether the data will be scaled by standard deviations during training.
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.
double Beta() const
Get the precision (or inverse variance) beta of the model.
size_t & MaxIterations()
Modify the maximum number of iterations for training.
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.
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...
double Train(const arma::mat &data, const arma::rowvec &responses)
Run BayesianLinearRegression.
double Alpha() const
Get the precision (or inverse variance) of the gaussian prior.
double & Tolerance()
Modify the tolerance for training to converge.
A Bayesian approach to the maximum likelihood estimation of the parameters of the linear regression ...
bool CenterData() const
Get whether the data will be centered during training.
bool ScaleData() const
Get whether the data will be scaled by standard deviations during training.
bool & CenterData()
Modify whether the data will be centered during training.
double ResponsesOffset() const
Get the mean value of the train responses.
size_t MaxIterations() const
Get the maximum number of iterations for training.
const arma::colvec & DataScale() const
Get the vector of standard deviations computed on the features over the training points.