20 #include "ublas_trace.hpp" 26 namespace ublas = boost::numeric::ublas;
28 StudentTProcessJeffreys::StudentTProcessJeffreys(
size_t dim,
33 HierarchicalGaussianProcess(dim, params, data, mean, eng)
35 d_ =
new StudentTDistribution(eng);
40 StudentTProcessJeffreys::~StudentTProcessJeffreys()
51 return negativeTotalLogLikelihood();
58 clock_t start = clock();
59 double kq = computeSelfCorrelation(query);
61 mKernel.computeCrossCorrelation(mData.mX,query,mKn);
62 vectord phi = mMean.getFeatures(query);
65 inplace_solve(mL,mKn,ublas::lower_tag());
67 vectord rho = phi - prod(mKn,mKF);
70 inplace_solve(mL2,rho,ublas::lower_tag());
72 double yPred = inner_prod(phi,mWML) + inner_prod(mKn,mAlphaF);
73 double sPred = sqrt( mSigma * (kq - inner_prod(mKn,mKn)
74 + inner_prod(rho,rho)));
76 d_->setMeanAndStd(yPred,sPred);
82 size_t n = mData.getNSamples();
83 size_t p = mMean.nFeatures();
87 mKF = trans(mMean.mFeatM);
88 inplace_solve(mL,mKF,ublas::lower_tag());
90 matrixd FKF = prod(trans(mKF),mKF);
95 inplace_solve(mL,Ky,ublas::lower_tag());
100 mAlphaF = mData.mY - prod(mWML,mMean.mFeatM);
101 inplace_solve(mL,mAlphaF,ublas::lower_tag());
102 mSigma = inner_prod(mAlphaF,mAlphaF)/(n-p);
Namespace of the library interface.
Student T process with Jeffreys priors.
size_t cholesky_decompose(const MATRIX &A, TRIA &L)
decompose the symmetric positive definit matrix A into product L L^T.
ProbabilityDistribution * prediction(const vectord &query)
Function that returns the prediction of the GP for a query point in the hypercube [0...
void cholesky_solve(const TRIA &L, MATRIX &x, ublas::lower)
solve system L L^T x = b inplace
double negativeLogLikelihood()
Computes the negative log likelihood and its gradient of the data.
void precomputePrediction()
Precompute some values of the prediction that do not depends on the query.