SHOGUN  v3.2.0
FITCInferenceMethod.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2013 Roman Votyakov
8  * Copyright (C) 2012 Jacob Walker
9  * Copyright (C) 2013 Roman Votyakov
10  *
11  * Code adapted from Gaussian Process Machine Learning Toolbox
12  * http://www.gaussianprocess.org/gpml/code/matlab/doc/
13  */
14 
16 
17 #ifdef HAVE_EIGEN3
18 
23 
24 using namespace shogun;
25 using namespace Eigen;
26 
28 {
29  init();
30 }
31 
33  CMeanFunction* m, CLabels* lab, CLikelihoodModel* mod, CFeatures* lat)
34  : CInferenceMethod(kern, feat, m, lab, mod)
35 {
36  init();
38 }
39 
40 void CFITCInferenceMethod::init()
41 {
42  SG_ADD((CSGObject**)&m_latent_features, "latent_features", "Latent features",
44 
45  m_latent_features=NULL;
46  m_ind_noise=1e-10;
47 }
48 
50 {
51  SG_UNREF(m_latent_features);
52 }
53 
55  CInferenceMethod* inference)
56 {
57  ASSERT(inference!=NULL);
58 
59  if (inference->get_inference_type()!=INF_FITC)
60  SG_SERROR("Provided inference is not of type CFITCInferenceMethod!\n")
61 
62  SG_REF(inference);
63  return (CFITCInferenceMethod*)inference;
64 }
65 
67 {
69  update_chol();
70  update_alpha();
71  update_deriv();
72 }
73 
75 {
77 
79  "FITC inference method can only use Gaussian likelihood function\n")
80  REQUIRE(m_labels->get_label_type()==LT_REGRESSION, "Labels must be type "
81  "of CRegressionLabels\n")
82  REQUIRE(m_latent_features, "Latent features should not be NULL\n")
83  REQUIRE(m_latent_features->get_num_vectors(),
84  "Number of latent features must be greater than zero\n")
85 }
86 
88 {
90  update();
91 
92  // get the sigma variable from the Gaussian likelihood model
94  float64_t sigma=lik->get_sigma();
95  SG_UNREF(lik);
96 
97  // compute diagonal vector: sW=1/sigma
99  result.fill_vector(result.vector, m_features->get_num_vectors(), 1.0/sigma);
100 
101  return result;
102 }
103 
105 {
106  if (update_parameter_hash())
107  update();
108 
109  // create eigen representations of chol_utr, dg, r, be
110  Map<MatrixXd> eigen_chol_utr(m_chol_utr.matrix, m_chol_utr.num_rows,
111  m_chol_utr.num_cols);
112  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
113  Map<VectorXd> eigen_r(m_r.vector, m_r.vlen);
114  Map<VectorXd> eigen_be(m_be.vector, m_be.vlen);
115 
116  // compute negative log marginal likelihood:
117  // nlZ=sum(log(diag(utr)))+(sum(log(dg))+r'*r-be'*be+n*log(2*pi))/2
118  float64_t result=eigen_chol_utr.diagonal().array().log().sum()+
119  (eigen_dg.array().log().sum()+eigen_r.dot(eigen_r)-eigen_be.dot(eigen_be)+
121 
122  return result;
123 }
124 
126 {
127  if (update_parameter_hash())
128  update();
129 
131  return result;
132 }
133 
135 {
136  if (update_parameter_hash())
137  update();
138 
139  SGMatrix<float64_t> result(m_L);
140  return result;
141 }
142 
144 {
146  return SGVector<float64_t>();
147 }
148 
150 {
152  return SGMatrix<float64_t>();
153 }
154 
156 {
158 
159  // create kernel matrix for latent features
160  m_kernel->init(m_latent_features, m_latent_features);
161  m_kuu=m_kernel->get_kernel_matrix();
162 
163  // create kernel matrix for latent and training features
164  m_kernel->init(m_latent_features, m_features);
165  m_ktru=m_kernel->get_kernel_matrix();
166 }
167 
169 {
170  // get the sigma variable from the Gaussian likelihood model
172  float64_t sigma=lik->get_sigma();
173  SG_UNREF(lik);
174 
175  // eigen3 representation of covariance matrix of latent features (m_kuu)
176  // and training features (m_ktru)
177  Map<MatrixXd> eigen_kuu(m_kuu.matrix, m_kuu.num_rows, m_kuu.num_cols);
178  Map<MatrixXd> eigen_ktru(m_ktru.matrix, m_ktru.num_rows, m_ktru.num_cols);
179  Map<MatrixXd> eigen_ktrtr(m_ktrtr.matrix, m_ktrtr.num_rows, m_ktrtr.num_cols);
180 
181  // solve Luu' * Luu = Kuu + m_ind_noise * I
182  LLT<MatrixXd> Luu(eigen_kuu*CMath::sq(m_scale)+m_ind_noise*MatrixXd::Identity(
183  m_kuu.num_rows, m_kuu.num_cols));
184 
185  // create shogun and eigen3 representation of cholesky of covariance of
186  // latent features Luu (m_chol_uu and eigen_chol_uu)
187  m_chol_uu=SGMatrix<float64_t>(Luu.rows(), Luu.cols());
188  Map<MatrixXd> eigen_chol_uu(m_chol_uu.matrix, m_chol_uu.num_rows,
189  m_chol_uu.num_cols);
190  eigen_chol_uu=Luu.matrixU();
191 
192  // solve Luu' * V = Ktru
193  MatrixXd V=eigen_chol_uu.triangularView<Upper>().adjoint().solve(eigen_ktru*
194  CMath::sq(m_scale));
195 
196  // create shogun and eigen3 representation of
197  // dg = diag(K) + sn2 - diag(Q)
199  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
200 
201  eigen_dg=eigen_ktrtr.diagonal()*CMath::sq(m_scale)+CMath::sq(sigma)*
202  VectorXd::Ones(m_dg.vlen)-(V.cwiseProduct(V)).colwise().sum().adjoint();
203 
204  // solve Lu' * Lu = V * diag(1/dg) * V' + I
205  LLT<MatrixXd> Lu(V*((VectorXd::Ones(m_dg.vlen)).cwiseQuotient(eigen_dg)).asDiagonal()*
206  V.adjoint()+MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
207 
208  // create shogun and eigen3 representation of cholesky of covariance of
209  // training features Luu (m_chol_utr and eigen_chol_utr)
210  m_chol_utr=SGMatrix<float64_t>(Lu.rows(), Lu.cols());
211  Map<MatrixXd> eigen_chol_utr(m_chol_utr.matrix, m_chol_utr.num_rows,
212  m_chol_utr.num_cols);
213  eigen_chol_utr=Lu.matrixU();
214 
215  // create eigen representation of labels and mean vectors
216  SGVector<float64_t> y=((CRegressionLabels*) m_labels)->get_labels();
217  Map<VectorXd> eigen_y(y.vector, y.vlen);
219  Map<VectorXd> eigen_m(m.vector, m.vlen);
220 
221  // compute sgrt_dg = sqrt(dg)
222  VectorXd sqrt_dg=eigen_dg.array().sqrt();
223 
224  // create shogun and eigen3 representation of labels adjusted for
225  // noise and means (m_r)
226  m_r=SGVector<float64_t>(y.vlen);
227  Map<VectorXd> eigen_r(m_r.vector, m_r.vlen);
228  eigen_r=(eigen_y-eigen_m).cwiseQuotient(sqrt_dg);
229 
230  // compute be
231  m_be=SGVector<float64_t>(m_chol_utr.num_cols);
232  Map<VectorXd> eigen_be(m_be.vector, m_be.vlen);
233  eigen_be=eigen_chol_utr.triangularView<Upper>().adjoint().solve(
234  V*eigen_r.cwiseQuotient(sqrt_dg));
235 
236  // compute iKuu
237  MatrixXd iKuu=Luu.solve(MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
238 
239  // create shogun and eigen3 representation of posterior cholesky
240  MatrixXd eigen_prod=eigen_chol_utr*eigen_chol_uu;
242  Map<MatrixXd> eigen_chol(m_L.matrix, m_L.num_rows, m_L.num_cols);
243 
244  eigen_chol=eigen_prod.triangularView<Upper>().adjoint().solve(
245  MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
246  eigen_chol=eigen_prod.triangularView<Upper>().solve(eigen_chol)-iKuu;
247 }
248 
250 {
251  Map<MatrixXd> eigen_chol_uu(m_chol_uu.matrix, m_chol_uu.num_rows,
252  m_chol_uu.num_cols);
253  Map<MatrixXd> eigen_chol_utr(m_chol_utr.matrix, m_chol_utr.num_rows,
254  m_chol_utr.num_cols);
255  Map<VectorXd> eigen_be(m_be.vector, m_be.vlen);
256 
257  // create shogun and eigen representations of alpha
258  // and solve Luu * Lu * alpha = be
260  Map<VectorXd> eigen_alpha(m_alpha.vector, m_alpha.vlen);
261 
262  eigen_alpha=eigen_chol_utr.triangularView<Upper>().solve(eigen_be);
263  eigen_alpha=eigen_chol_uu.triangularView<Upper>().solve(eigen_alpha);
264 }
265 
267 {
268  // create eigen representation of Ktru, Lu, Luu, dg, be
269  Map<MatrixXd> eigen_Ktru(m_ktru.matrix, m_ktru.num_rows, m_ktru.num_cols);
270  Map<MatrixXd> eigen_Lu(m_chol_utr.matrix, m_chol_utr.num_rows,
271  m_chol_utr.num_cols);
272  Map<MatrixXd> eigen_Luu(m_chol_uu.matrix, m_chol_uu.num_rows,
273  m_chol_uu.num_cols);
274  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
275  Map<VectorXd> eigen_be(m_be.vector, m_be.vlen);
276 
277  // get and create eigen representation of labels
278  SGVector<float64_t> y=((CRegressionLabels*) m_labels)->get_labels();
279  Map<VectorXd> eigen_y(y.vector, y.vlen);
280 
281  // get and create eigen representation of mean vector
283  Map<VectorXd> eigen_m(m.vector, m.vlen);
284 
285  // compute V=inv(Luu')*Ku
286  MatrixXd V=eigen_Luu.triangularView<Upper>().adjoint().solve(eigen_Ktru*
287  CMath::sq(m_scale));
288 
289  // create shogun and eigen representation of al
290  m_al=SGVector<float64_t>(m.vlen);
291  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
292 
293  // compute al=(Kt+sn2*eye(n))\y
294  eigen_al=((eigen_y-eigen_m)-(V.adjoint()*
295  eigen_Lu.triangularView<Upper>().solve(eigen_be))).cwiseQuotient(eigen_dg);
296 
297  // compute inv(Kuu+snu2*I)=iKuu
298  MatrixXd iKuu=eigen_Luu.triangularView<Upper>().adjoint().solve(
299  MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
300  iKuu=eigen_Luu.triangularView<Upper>().solve(iKuu);
301 
302  // create shogun and eigen representation of B
303  m_B=SGMatrix<float64_t>(iKuu.rows(), eigen_Ktru.cols());
304  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
305 
306  eigen_B=iKuu*eigen_Ktru*CMath::sq(m_scale);
307 
308  // create shogun and eigen representation of w
309  m_w=SGVector<float64_t>(m_B.num_rows);
310  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
311 
312  eigen_w=eigen_B*eigen_al;
313 
314  // create shogun and eigen representation of W
315  m_W=SGMatrix<float64_t>(m_chol_utr.num_cols, m_dg.vlen);
316  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
317 
318  // compute W=Lu'\(V./repmat(g_sn2',nu,1))
319  eigen_W=eigen_Lu.triangularView<Upper>().adjoint().solve(V*VectorXd::Ones(
320  m_dg.vlen).cwiseQuotient(eigen_dg).asDiagonal());
321 }
322 
324  const TParameter* param)
325 {
326  REQUIRE(!strcmp(param->m_name, "scale"), "Can't compute derivative of "
327  "the nagative log marginal likelihood wrt %s.%s parameter\n",
328  get_name(), param->m_name)
329 
330  // create eigen representation of dg, al, B, W, w
331  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
332  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
333  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
334  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
335  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
336 
337  // clone kernel matrices
339  SGMatrix<float64_t> deriv_uu=m_kuu.clone();
340  SGMatrix<float64_t> deriv_tru=m_ktru.clone();
341 
342  // create eigen representation of kernel matrices
343  Map<VectorXd> ddiagKi(deriv_trtr.vector, deriv_trtr.vlen);
344  Map<MatrixXd> dKuui(deriv_uu.matrix, deriv_uu.num_rows, deriv_uu.num_cols);
345  Map<MatrixXd> dKui(deriv_tru.matrix, deriv_tru.num_rows, deriv_tru.num_cols);
346 
347  // compute derivatives wrt scale for each kernel matrix
348  ddiagKi*=m_scale*2.0;
349  dKuui*=m_scale*2.0;
350  dKui*=m_scale*2.0;
351 
352  // compute R=2*dKui-dKuui*B
353  MatrixXd R=2*dKui-dKuui*eigen_B;
354 
355  // compute v=ddiagKi-sum(R.*B, 1)'
356  VectorXd v=ddiagKi-R.cwiseProduct(eigen_B).colwise().sum().adjoint();
357 
358  SGVector<float64_t> result(1);
359 
360  // compute dnlZ=(ddiagKi'*(1./g_sn2)+w'*(dKuui*w-2*(dKui*al))-al'*(v.*al)-
361  // sum(W.*W,1)*v- sum(sum((R*W').*(B*W'))))/2;
362  result[0]=(ddiagKi.dot(VectorXd::Ones(m_dg.vlen).cwiseQuotient(eigen_dg))+
363  eigen_w.dot(dKuui*eigen_w-2*(dKui*eigen_al))-
364  eigen_al.dot(v.cwiseProduct(eigen_al))-
365  eigen_W.cwiseProduct(eigen_W).colwise().sum().dot(v)-
366  (R*eigen_W.adjoint()).cwiseProduct(eigen_B*eigen_W.adjoint()).sum())/2.0;
367 
368  return result;
369 }
370 
372  const TParameter* param)
373 {
374  REQUIRE(!strcmp(param->m_name, "sigma"), "Can't compute derivative of "
375  "the nagative log marginal likelihood wrt %s.%s parameter\n",
376  m_model->get_name(), param->m_name)
377 
378  // create eigen representation of dg, al, w, W and B
379  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
380  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
381  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
382  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
383  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
384 
385  // get the sigma variable from the Gaussian likelihood model
387  float64_t sigma=lik->get_sigma();
388  SG_UNREF(lik);
389 
390  SGVector<float64_t> result(1);
391 
392  result[0]=CMath::sq(sigma)*(VectorXd::Ones(m_dg.vlen).cwiseQuotient(
393  eigen_dg).sum()-eigen_W.cwiseProduct(eigen_W).sum()-eigen_al.dot(eigen_al));
394 
395  float64_t dKuui=2.0*m_ind_noise;
396  MatrixXd R=-dKuui*eigen_B;
397  VectorXd v=-R.cwiseProduct(eigen_B).colwise().sum().adjoint();
398 
399  result[0]=result[0]+((eigen_w.dot(dKuui*eigen_w))-eigen_al.dot(
400  v.cwiseProduct(eigen_al))-eigen_W.cwiseProduct(eigen_W).colwise().sum().dot(v)-
401  (R*eigen_W.adjoint()).cwiseProduct(eigen_B*eigen_W.adjoint()).sum())/2.0;
402 
403  return result;
404 }
405 
407  const TParameter* param)
408 {
409  // create eigen representation of dg, al, w, W, B
410  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
411  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
412  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
413  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
414  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
415 
416  SGVector<float64_t> result;
417 
418  if (param->m_datatype.m_ctype==CT_VECTOR ||
419  param->m_datatype.m_ctype==CT_SGVECTOR)
420  {
422  "Length of the parameter %s should not be NULL\n", param->m_name)
423  result=SGVector<float64_t>(*(param->m_datatype.m_length_y));
424  }
425  else
426  {
427  result=SGVector<float64_t>(1);
428  }
429 
430  for (index_t i=0; i<result.vlen; i++)
431  {
432  SGVector<float64_t> deriv_trtr;
433  SGMatrix<float64_t> deriv_uu;
434  SGMatrix<float64_t> deriv_tru;
435 
436  if (result.vlen==1)
437  {
440 
441  m_kernel->init(m_latent_features, m_latent_features);
442  deriv_uu=m_kernel->get_parameter_gradient(param);
443 
444  m_kernel->init(m_latent_features, m_features);
445  deriv_tru=m_kernel->get_parameter_gradient(param);
446  }
447  else
448  {
450  deriv_trtr=m_kernel->get_parameter_gradient(param, i).get_diagonal_vector();
451 
452  m_kernel->init(m_latent_features, m_latent_features);
453  deriv_uu=m_kernel->get_parameter_gradient(param, i);
454 
455  m_kernel->init(m_latent_features, m_features);
456  deriv_tru=m_kernel->get_parameter_gradient(param, i);
457  }
458 
459  // create eigen representation of derivatives
460  Map<VectorXd> ddiagKi(deriv_trtr.vector, deriv_trtr.vlen);
461  Map<MatrixXd> dKuui(deriv_uu.matrix, deriv_uu.num_rows,
462  deriv_uu.num_cols);
463  Map<MatrixXd> dKui(deriv_tru.matrix, deriv_tru.num_rows,
464  deriv_tru.num_cols);
465 
466  ddiagKi*=CMath::sq(m_scale);
467  dKuui*=CMath::sq(m_scale);
468  dKui*=CMath::sq(m_scale);
469 
470  // compute R=2*dKui-dKuui*B
471  MatrixXd R=2*dKui-dKuui*eigen_B;
472 
473  // compute v=ddiagKi-sum(R.*B, 1)'
474  VectorXd v=ddiagKi-R.cwiseProduct(eigen_B).colwise().sum().adjoint();
475 
476  // compute dnlZ=(ddiagKi'*(1./g_sn2)+w'*(dKuui*w-2*(dKui*al))-al'*
477  // (v.*al)-sum(W.*W,1)*v- sum(sum((R*W').*(B*W'))))/2;
478  result[i]=(ddiagKi.dot(VectorXd::Ones(m_dg.vlen).cwiseQuotient(eigen_dg))+
479  eigen_w.dot(dKuui*eigen_w-2*(dKui*eigen_al))-
480  eigen_al.dot(v.cwiseProduct(eigen_al))-
481  eigen_W.cwiseProduct(eigen_W).colwise().sum().dot(v)-
482  (R*eigen_W.adjoint()).cwiseProduct(eigen_B*eigen_W.adjoint()).sum())/2.0;
483  }
484 
485  return result;
486 }
487 
489  const TParameter* param)
490 {
491  // create eigen representation of al vector
492  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
493 
494  SGVector<float64_t> result;
495 
496  if (param->m_datatype.m_ctype==CT_VECTOR ||
497  param->m_datatype.m_ctype==CT_SGVECTOR)
498  {
500  "Length of the parameter %s should not be NULL\n", param->m_name)
501 
502  result=SGVector<float64_t>(*(param->m_datatype.m_length_y));
503  }
504  else
505  {
506  result=SGVector<float64_t>(1);
507  }
508 
509  for (index_t i=0; i<result.vlen; i++)
510  {
512 
513  if (result.vlen==1)
515  else
517 
518  Map<VectorXd> eigen_dmu(dmu.vector, dmu.vlen);
519 
520  // compute dnlZ=-dm'*al
521  result[i]=-eigen_dmu.dot(eigen_al);
522  }
523 
524  return result;
525 }
526 
527 #endif /* HAVE_EIGEN3 */
virtual const char * get_name() const =0
virtual bool init(CFeatures *lhs, CFeatures *rhs)
Definition: Kernel.cpp:83
SGMatrix< T > clone()
Definition: SGMatrix.cpp:130
virtual SGVector< float64_t > get_derivative_wrt_inference_method(const TParameter *param)
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
compute dot product between v1 and v2 (blas optimized)
Definition: SGVector.h:344
virtual ELabelType get_label_type() const =0
Class that models Gaussian likelihood.
Real Labels are real-valued labels.
SGVector< float64_t > m_alpha
The Inference Method base class.
virtual SGVector< float64_t > get_diagonal_vector()
int32_t index_t
Definition: common.h:60
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:35
real valued labels (e.g. for regression, classifier outputs)
Definition: LabelTypes.h:18
#define SG_UNREF(x)
Definition: SGRefObject.h:35
static T sq(T x)
x^2
Definition: Math.h:239
virtual const char * get_name() const
virtual ELikelihoodModelType get_model_type() const
parameter struct
Definition: Parameter.h:26
virtual int32_t get_num_vectors() const =0
virtual SGMatrix< float64_t > get_cholesky()
#define REQUIRE(x,...)
Definition: SGIO.h:208
#define SG_NOTIMPLEMENTED
Definition: SGIO.h:141
virtual SGVector< float64_t > get_posterior_mean()
void sqrt()
square root of vector elements
virtual SGVector< float64_t > get_mean_vector(const CFeatures *features) const =0
An abstract class of the mean function.
Definition: MeanFunction.h:26
SGMatrix< float64_t > get_kernel_matrix()
Definition: Kernel.h:211
virtual bool update_parameter_hash()
Definition: SGObject.cpp:187
virtual float64_t get_negative_log_marginal_likelihood()
virtual void check_members() const
TSGDataType m_datatype
Definition: Parameter.h:156
SGMatrix< float64_t > m_L
#define ASSERT(x)
Definition: SGIO.h:203
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:102
virtual SGVector< float64_t > get_derivative_wrt_kernel(const TParameter *param)
double float64_t
Definition: common.h:48
#define SG_REF(x)
Definition: SGRefObject.h:34
index_t num_rows
Definition: SGMatrix.h:301
virtual void update_train_kernel()
static void fill_vector(T *vec, int32_t len, T value)
Definition: SGVector.cpp:271
index_t num_cols
Definition: SGMatrix.h:303
static CGaussianLikelihood * obtain_from_generic(CLikelihoodModel *lik)
index_t * m_length_y
Definition: DataType.h:77
virtual SGVector< float64_t > get_parameter_derivative(const CFeatures *features, const TParameter *param, index_t index=-1)
Definition: MeanFunction.h:50
EContainerType m_ctype
Definition: DataType.h:70
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:16
The class Features is the base class of all feature objects.
Definition: Features.h:62
#define SG_SERROR(...)
Definition: SGIO.h:181
The Fully Independent Conditional Training inference method class.
virtual SGVector< float64_t > get_derivative_wrt_likelihood_model(const TParameter *param)
virtual SGMatrix< float64_t > get_parameter_gradient(const TParameter *param, index_t index=-1)
Definition: Kernel.h:574
static float64_t log(float64_t v)
Definition: Math.h:420
virtual void set_latent_features(CFeatures *feat)
virtual void check_members() const
virtual EInferenceType get_inference_type() const
The Kernel base class.
Definition: Kernel.h:150
SGVector< T > get_diagonal_vector() const
Definition: SGMatrix.cpp:978
#define SG_ADD(...)
Definition: SGObject.h:71
virtual SGVector< float64_t > get_derivative_wrt_mean(const TParameter *param)
virtual SGVector< float64_t > get_alpha()
The Likelihood model base class.
SGMatrix< float64_t > m_ktrtr
CLikelihoodModel * m_model
virtual SGMatrix< float64_t > get_posterior_covariance()
index_t vlen
Definition: SGVector.h:706
static CFITCInferenceMethod * obtain_from_generic(CInferenceMethod *inference)
static const float64_t PI
Definition: Math.h:1337

SHOGUN Machine Learning Toolbox - Documentation