15#ifndef MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP
16#define MLPACK_METHODS_BAYESIAN_LINEAR_REGRESSION_HPP
115 const bool scaleData =
false,
116 const size_t nIterMax = 50,
117 const double tol = 1e-4);
128 const arma::rowvec& responses);
139 arma::rowvec& predictions)
const;
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>
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"
A Bayesian approach to the maximum likelihood estimation of the parameters of the linear regression ...
double Variance() const
Get the estimated variance.
const arma::colvec & DataScale() const
Get the vector of standard deviations computed on the features over the training points.
double Alpha() const
Get the precision (or inverse variance) of the gaussian prior.
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...
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.
const arma::colvec & DataOffset() const
Get the mean vector computed on the features over the training points.
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, arma::rowvec &std) const
Predict and the standard deviation of the predictive posterior distribution for each data point in t...
double ResponsesOffset() const
Get the mean value of the train responses.
double Train(const arma::mat &data, const arma::rowvec &responses)
Run BayesianLinearRegression.
double Beta() const
Get the precision (or inverse variance) beta of the model.
const arma::colvec & Omega() const
Get the solution vector.
void serialize(Archive &ar, const unsigned int)
Serialize the BayesianLinearRegression model.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.