43 using namespace Eigen;
61 SG_WARNING(
"The method does not require a minimizer. The provided minimizer will not be used.\n");
96 "Exact inference method can only use Gaussian likelihood function\n")
98 "Labels must be type of CRegressionLabels\n")
140 float64_t result=(eigen_y-eigen_m).
dot(eigen_alpha)/2.0+
141 eigen_L.diagonal().array().log().sum()+
m_L.
num_rows*
216 a=L.triangularView<Upper>().adjoint().solve(eigen_y-eigen_m);
217 a=L.triangularView<Upper>().solve(a);
250 MatrixXd eigen_V=eigen_L.triangularView<Upper>().adjoint().solve(
256 eigen_V = eigen_V/sigma;
277 eigen_Q=eigen_L.triangularView<Upper>().adjoint().solve(
279 eigen_Q=eigen_L.triangularView<Upper>().solve(eigen_Q);
285 eigen_Q-=eigen_alpha*eigen_alpha.transpose();
291 REQUIRE(!strcmp(param->
m_name,
"log_scale"),
"Can't compute derivative of "
292 "the nagative log marginal likelihood wrt %s.%s parameter\n",
301 result[0]=(eigen_Q.cwiseProduct(eigen_K)).sum();
314 SG_SERROR(
"Provided inference is not of type CExactInferenceMethod!\n")
323 REQUIRE(!strcmp(param->
m_name,
"log_sigma"),
"Can't compute derivative of "
324 "the nagative log marginal likelihood wrt %s.%s parameter\n",
339 result[0]=
CMath::sq(sigma)*eigen_Q.trace();
350 REQUIRE(param,
"Param not set\n");
352 int64_t len=
const_cast<TParameter *
>(param)->m_datatype.get_num_elements();
367 result[i]=(eigen_Q.cwiseProduct(eigen_dK)).sum();
380 REQUIRE(param,
"Param not set\n");
382 int64_t len=
const_cast<TParameter *
>(param)->m_datatype.get_num_elements();
397 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.
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.
virtual EInferenceType get_inference_type() const
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 void register_minimizer(Minimizer *minimizer)
virtual int32_t get_num_vectors() const =0
virtual void update_mean()
virtual SGVector< float64_t > get_mean_vector(const CFeatures *features) const =0
An abstract class of the mean function.
SGMatrix< float64_t > m_ktrtr
virtual void update_chol()
virtual ~CExactInferenceMethod()
virtual SGMatrix< float64_t > get_cholesky()
virtual SGVector< float64_t > get_derivative_wrt_mean(const TParameter *param)
virtual SGVector< float64_t > get_derivative_wrt_inference_method(const TParameter *param)
virtual void compute_gradient()
virtual SGVector< float64_t > get_diagonal_vector()
SGMatrix< float64_t > m_L
virtual void compute_gradient()
static CGaussianLikelihood * obtain_from_generic(CLikelihoodModel *lik)
static CExactInferenceMethod * obtain_from_generic(CInference *inference)
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
The Inference Method base class.
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 SGVector< float64_t > get_derivative_wrt_likelihood_model(const TParameter *param)
virtual void update_alpha()
virtual void update_cov()
The minimizer base class.
virtual void check_members() const
CLikelihoodModel * m_model
virtual bool parameter_hash_changed()
The Likelihood model base class.
virtual SGVector< float64_t > get_posterior_mean()
SGVector< float64_t > m_alpha
virtual void check_members() const
static const float64_t PI