10 #ifndef MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP 11 #define MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP 16 namespace regression {
110 const bool scaleData =
false,
111 const size_t nIterMax = 50,
112 const double tol = 1e-4);
122 double Train(
const arma::mat& data,
123 const arma::rowvec& responses);
133 void Predict(
const arma::mat& points,
134 arma::rowvec& predictions)
const;
145 void Predict(
const arma::mat& points,
146 arma::rowvec& predictions,
147 arma::rowvec&
std)
const;
157 double RMSE(
const arma::mat& data,
158 const arma::rowvec& responses)
const;
165 const arma::colvec&
Omega()
const {
return omega; }
173 double Alpha()
const {
return alpha; }
181 double Beta()
const {
return beta; }
195 const arma::colvec&
DataOffset()
const {
return dataOffset; }
203 const arma::colvec&
DataScale()
const {
return dataScale; }
215 template<
typename Archive>
216 void serialize(Archive& ar,
const unsigned int );
232 arma::colvec dataOffset;
235 arma::colvec dataScale;
238 double responsesOffset;
253 arma::mat matCovariance;
265 double CenterScaleData(
const arma::mat& data,
266 const arma::rowvec& responses,
268 arma::rowvec& responsesProc);
276 void CenterScaleDataPred(
const arma::mat& data,
277 arma::mat& dataProc)
const;
283 #include "bayesian_linear_regression_impl.hpp" 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.
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 Variance() const
Get the estimated variance.
Linear algebra utility functions, generally performed on matrices or vectors.
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.
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.
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.
double ResponsesOffset() const
Get the mean value of the train responses.
const arma::colvec & DataScale() const
Get the vector of standard deviations computed on the features over the training points.