15 #ifndef MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP
16 #define MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP
21 namespace regression {
115 const bool scaleData =
false,
116 const size_t nIterMax = 50,
117 const double tol = 1e-4);
127 double Train(
const arma::mat& data,
128 const arma::rowvec& responses);
138 void Predict(
const arma::mat& points,
139 arma::rowvec& predictions)
const;
150 void Predict(
const arma::mat& points,
151 arma::rowvec& predictions,
152 arma::rowvec& std)
const;
162 double RMSE(
const arma::mat& data,
163 const arma::rowvec& responses)
const;
170 const arma::colvec&
Omega()
const {
return omega; }
178 double Alpha()
const {
return alpha; }
186 double Beta()
const {
return beta; }
200 const arma::colvec&
DataOffset()
const {
return dataOffset; }
208 const arma::colvec&
DataScale()
const {
return dataScale; }
220 template<
typename Archive>
221 void serialize(Archive& ar,
const unsigned int );
237 arma::colvec dataOffset;
240 arma::colvec dataScale;
243 double responsesOffset;
258 arma::mat matCovariance;
270 double CenterScaleData(
const arma::mat& data,
271 const arma::rowvec& responses,
273 arma::rowvec& responsesProc);
281 void CenterScaleDataPred(
const arma::mat& data,
282 arma::mat& dataProc)
const;
288 #include "bayesian_linear_regression_impl.hpp"
BayesianLinearRegression(const bool centerData=true, const bool scaleData=false, const size_t nIterMax=50, const double tol=1e-4)
Set the parameters of Bayesian Ridge regression object.
double ResponsesOffset() const
Get the mean value of the train responses.
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...
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...
const arma::colvec & Omega() const
Get the solution vector.
double Variance() const
Get the estimated variance.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Beta() const
Get the precision (or inverse variance) beta of the model.
double Alpha() const
Get the precision (or inverse variance) of the gaussian prior.
const arma::colvec & DataOffset() const
Get the mean vector computed on the features over the training points.
double Train(const arma::mat &data, const arma::rowvec &responses)
Run BayesianLinearRegression.
const arma::colvec & DataScale() const
Get the vector of standard deviations computed on the features over the training points.
A Bayesian approach to the maximum likelihood estimation of the parameters of the linear regression ...
void serialize(Archive &ar, const unsigned int)
Serialize the BayesianLinearRegression model.