44 using namespace Eigen;
92 "Exact inference method can only use Gaussian likelihood function\n")
94 "Labels must be type of CRegressionLabels\n")
136 float64_t result=(eigen_y-eigen_m).
dot(eigen_alpha)/2.0+
137 eigen_L.diagonal().array().log().sum()+
m_L.
num_rows*
212 a=L.triangularView<Upper>().adjoint().solve(eigen_y-eigen_m);
213 a=L.triangularView<Upper>().solve(a);
246 MatrixXd eigen_V=eigen_L.triangularView<Upper>().adjoint().solve(
252 eigen_V = eigen_V/sigma;
273 eigen_Q=eigen_L.triangularView<Upper>().adjoint().solve(
275 eigen_Q=eigen_L.triangularView<Upper>().solve(eigen_Q);
281 eigen_Q-=eigen_alpha*eigen_alpha.transpose();
287 REQUIRE(!strcmp(param->
m_name,
"log_scale"),
"Can't compute derivative of "
288 "the nagative log marginal likelihood wrt %s.%s parameter\n",
297 result[0]=(eigen_Q.cwiseProduct(eigen_K)).sum();
310 SG_SERROR(
"Provided inference is not of type CExactInferenceMethod!\n")
319 REQUIRE(!strcmp(param->
m_name,
"log_sigma"),
"Can't compute derivative of "
320 "the nagative log marginal likelihood wrt %s.%s parameter\n",
335 result[0]=
CMath::sq(sigma)*eigen_Q.trace();
346 REQUIRE(param,
"Param not set\n");
348 int64_t len=
const_cast<TParameter *
>(param)->m_datatype.get_num_elements();
363 result[i]=(eigen_Q.cwiseProduct(eigen_dK)).sum();
376 REQUIRE(param,
"Param not set\n");
378 int64_t len=
const_cast<TParameter *
>(param)->m_datatype.get_num_elements();
393 result[i]=-eigen_dmu.dot(eigen_alpha);
virtual const char * get_name() const =0
virtual void update_deriv()
static void fill_vector(T *vec, int32_t len, T value)
The Gaussian exact form inference method class.
virtual ELabelType get_label_type() const =0
virtual void update_parameter_hash()
Class that models Gaussian likelihood.
Real Labels are real-valued labels.
SGVector< float64_t > m_alpha
The Inference Method base class.
virtual SGMatrix< float64_t > get_posterior_covariance()
Vector::Scalar dot(Vector a, Vector b)
The class Labels models labels, i.e. class assignments of objects.
real valued labels (e.g. for regression, classifier outputs)
virtual const char * get_name() const
virtual SGVector< float64_t > get_alpha()
virtual ELikelihoodModelType get_model_type() const
virtual int32_t get_num_vectors() const =0
virtual void update_mean()
virtual SGVector< float64_t > get_mean_vector(const CFeatures *features) const =0
static CExactInferenceMethod * obtain_from_generic(CInferenceMethod *inference)
An abstract class of the mean function.
SGMatrix< float64_t > m_L
virtual void update_chol()
virtual ~CExactInferenceMethod()
virtual SGMatrix< float64_t > get_cholesky()
virtual SGVector< float64_t > get_derivative_wrt_mean(const TParameter *param)
virtual void compute_gradient()
virtual SGVector< float64_t > get_derivative_wrt_inference_method(const TParameter *param)
virtual SGVector< float64_t > get_diagonal_vector()
virtual void compute_gradient()
static CGaussianLikelihood * obtain_from_generic(CLikelihoodModel *lik)
virtual SGVector< float64_t > get_parameter_derivative(const CFeatures *features, const TParameter *param, index_t index=-1)
all of classes and functions are contained in the shogun namespace
virtual float64_t get_negative_log_marginal_likelihood()
The class Features is the base class of all feature objects.
static float64_t exp(float64_t x)
virtual SGVector< float64_t > get_derivative_wrt_kernel(const TParameter *param)
virtual SGMatrix< float64_t > get_parameter_gradient(const TParameter *param, index_t index=-1)
static float64_t log(float64_t v)
virtual void check_members() const
virtual SGVector< float64_t > get_derivative_wrt_likelihood_model(const TParameter *param)
virtual EInferenceType get_inference_type() const
virtual void update_alpha()
virtual void update_cov()
virtual void check_members() const
virtual bool parameter_hash_changed()
The Likelihood model base class.
SGMatrix< float64_t > m_ktrtr
CLikelihoodModel * m_model
virtual SGVector< float64_t > get_posterior_mean()
static const float64_t PI