SHOGUN  v3.1.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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->cleanup();
161  m_kernel->init(m_latent_features, m_latent_features);
162  m_kuu=m_kernel->get_kernel_matrix();
163 
164  // create kernel matrix for latent and training features
165  m_kernel->cleanup();
166  m_kernel->init(m_latent_features, m_features);
167  m_ktru=m_kernel->get_kernel_matrix();
168 }
169 
171 {
172  // get the sigma variable from the Gaussian likelihood model
174  float64_t sigma=lik->get_sigma();
175  SG_UNREF(lik);
176 
177  // eigen3 representation of covariance matrix of latent features (m_kuu)
178  // and training features (m_ktru)
179  Map<MatrixXd> eigen_kuu(m_kuu.matrix, m_kuu.num_rows, m_kuu.num_cols);
180  Map<MatrixXd> eigen_ktru(m_ktru.matrix, m_ktru.num_rows, m_ktru.num_cols);
181  Map<MatrixXd> eigen_ktrtr(m_ktrtr.matrix, m_ktrtr.num_rows, m_ktrtr.num_cols);
182 
183  // solve Luu' * Luu = Kuu + m_ind_noise * I
184  LLT<MatrixXd> Luu(eigen_kuu*CMath::sq(m_scale)+m_ind_noise*MatrixXd::Identity(
185  m_kuu.num_rows, m_kuu.num_cols));
186 
187  // create shogun and eigen3 representation of cholesky of covariance of
188  // latent features Luu (m_chol_uu and eigen_chol_uu)
189  m_chol_uu=SGMatrix<float64_t>(Luu.rows(), Luu.cols());
190  Map<MatrixXd> eigen_chol_uu(m_chol_uu.matrix, m_chol_uu.num_rows,
191  m_chol_uu.num_cols);
192  eigen_chol_uu=Luu.matrixU();
193 
194  // solve Luu' * V = Ktru
195  MatrixXd V=eigen_chol_uu.triangularView<Upper>().adjoint().solve(eigen_ktru*
196  CMath::sq(m_scale));
197 
198  // create shogun and eigen3 representation of
199  // dg = diag(K) + sn2 - diag(Q)
201  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
202 
203  eigen_dg=eigen_ktrtr.diagonal()*CMath::sq(m_scale)+CMath::sq(sigma)*
204  VectorXd::Ones(m_dg.vlen)-(V.cwiseProduct(V)).colwise().sum().adjoint();
205 
206  // solve Lu' * Lu = V * diag(1/dg) * V' + I
207  LLT<MatrixXd> Lu(V*((VectorXd::Ones(m_dg.vlen)).cwiseQuotient(eigen_dg)).asDiagonal()*
208  V.adjoint()+MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
209 
210  // create shogun and eigen3 representation of cholesky of covariance of
211  // training features Luu (m_chol_utr and eigen_chol_utr)
212  m_chol_utr=SGMatrix<float64_t>(Lu.rows(), Lu.cols());
213  Map<MatrixXd> eigen_chol_utr(m_chol_utr.matrix, m_chol_utr.num_rows,
214  m_chol_utr.num_cols);
215  eigen_chol_utr=Lu.matrixU();
216 
217  // create eigen representation of labels and mean vectors
218  SGVector<float64_t> y=((CRegressionLabels*) m_labels)->get_labels();
219  Map<VectorXd> eigen_y(y.vector, y.vlen);
221  Map<VectorXd> eigen_m(m.vector, m.vlen);
222 
223  // compute sgrt_dg = sqrt(dg)
224  VectorXd sqrt_dg=eigen_dg.array().sqrt();
225 
226  // create shogun and eigen3 representation of labels adjusted for
227  // noise and means (m_r)
228  m_r=SGVector<float64_t>(y.vlen);
229  Map<VectorXd> eigen_r(m_r.vector, m_r.vlen);
230  eigen_r=(eigen_y-eigen_m).cwiseQuotient(sqrt_dg);
231 
232  // compute be
233  m_be=SGVector<float64_t>(m_chol_utr.num_cols);
234  Map<VectorXd> eigen_be(m_be.vector, m_be.vlen);
235  eigen_be=eigen_chol_utr.triangularView<Upper>().adjoint().solve(
236  V*eigen_r.cwiseQuotient(sqrt_dg));
237 
238  // compute iKuu
239  MatrixXd iKuu=Luu.solve(MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
240 
241  // create shogun and eigen3 representation of posterior cholesky
242  MatrixXd eigen_prod=eigen_chol_utr*eigen_chol_uu;
244  Map<MatrixXd> eigen_chol(m_L.matrix, m_L.num_rows, m_L.num_cols);
245 
246  eigen_chol=eigen_prod.triangularView<Upper>().adjoint().solve(
247  MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
248  eigen_chol=eigen_prod.triangularView<Upper>().solve(eigen_chol)-iKuu;
249 }
250 
252 {
253  Map<MatrixXd> eigen_chol_uu(m_chol_uu.matrix, m_chol_uu.num_rows,
254  m_chol_uu.num_cols);
255  Map<MatrixXd> eigen_chol_utr(m_chol_utr.matrix, m_chol_utr.num_rows,
256  m_chol_utr.num_cols);
257  Map<VectorXd> eigen_be(m_be.vector, m_be.vlen);
258 
259  // create shogun and eigen representations of alpha
260  // and solve Luu * Lu * alpha = be
262  Map<VectorXd> eigen_alpha(m_alpha.vector, m_alpha.vlen);
263 
264  eigen_alpha=eigen_chol_utr.triangularView<Upper>().solve(eigen_be);
265  eigen_alpha=eigen_chol_uu.triangularView<Upper>().solve(eigen_alpha);
266 }
267 
269 {
270  // create eigen representation of Ktru, Lu, Luu, dg, be
271  Map<MatrixXd> eigen_Ktru(m_ktru.matrix, m_ktru.num_rows, m_ktru.num_cols);
272  Map<MatrixXd> eigen_Lu(m_chol_utr.matrix, m_chol_utr.num_rows,
273  m_chol_utr.num_cols);
274  Map<MatrixXd> eigen_Luu(m_chol_uu.matrix, m_chol_uu.num_rows,
275  m_chol_uu.num_cols);
276  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
277  Map<VectorXd> eigen_be(m_be.vector, m_be.vlen);
278 
279  // get and create eigen representation of labels
280  SGVector<float64_t> y=((CRegressionLabels*) m_labels)->get_labels();
281  Map<VectorXd> eigen_y(y.vector, y.vlen);
282 
283  // get and create eigen representation of mean vector
285  Map<VectorXd> eigen_m(m.vector, m.vlen);
286 
287  // compute V=inv(Luu')*Ku
288  MatrixXd V=eigen_Luu.triangularView<Upper>().adjoint().solve(eigen_Ktru*
289  CMath::sq(m_scale));
290 
291  // create shogun and eigen representation of al
292  m_al=SGVector<float64_t>(m.vlen);
293  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
294 
295  // compute al=(Kt+sn2*eye(n))\y
296  eigen_al=((eigen_y-eigen_m)-(V.adjoint()*
297  eigen_Lu.triangularView<Upper>().solve(eigen_be))).cwiseQuotient(eigen_dg);
298 
299  // compute inv(Kuu+snu2*I)=iKuu
300  MatrixXd iKuu=eigen_Luu.triangularView<Upper>().adjoint().solve(
301  MatrixXd::Identity(m_kuu.num_rows, m_kuu.num_cols));
302  iKuu=eigen_Luu.triangularView<Upper>().solve(iKuu);
303 
304  // create shogun and eigen representation of B
305  m_B=SGMatrix<float64_t>(iKuu.rows(), eigen_Ktru.cols());
306  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
307 
308  eigen_B=iKuu*eigen_Ktru*CMath::sq(m_scale);
309 
310  // create shogun and eigen representation of w
311  m_w=SGVector<float64_t>(m_B.num_rows);
312  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
313 
314  eigen_w=eigen_B*eigen_al;
315 
316  // create shogun and eigen representation of W
317  m_W=SGMatrix<float64_t>(m_chol_utr.num_cols, m_dg.vlen);
318  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
319 
320  // compute W=Lu'\(V./repmat(g_sn2',nu,1))
321  eigen_W=eigen_Lu.triangularView<Upper>().adjoint().solve(V*VectorXd::Ones(
322  m_dg.vlen).cwiseQuotient(eigen_dg).asDiagonal());
323 }
324 
326  const TParameter* param)
327 {
328  REQUIRE(!strcmp(param->m_name, "scale"), "Can't compute derivative of "
329  "the nagative log marginal likelihood wrt %s.%s parameter\n",
330  get_name(), param->m_name)
331 
332  // create eigen representation of dg, al, B, W, w
333  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
334  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
335  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
336  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
337  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
338 
339  // clone kernel matrices
341  SGMatrix<float64_t> deriv_uu=m_kuu.clone();
342  SGMatrix<float64_t> deriv_tru=m_ktru.clone();
343 
344  // create eigen representation of kernel matrices
345  Map<VectorXd> ddiagKi(deriv_trtr.vector, deriv_trtr.vlen);
346  Map<MatrixXd> dKuui(deriv_uu.matrix, deriv_uu.num_rows, deriv_uu.num_cols);
347  Map<MatrixXd> dKui(deriv_tru.matrix, deriv_tru.num_rows, deriv_tru.num_cols);
348 
349  // compute derivatives wrt scale for each kernel matrix
350  ddiagKi*=m_scale*2.0;
351  dKuui*=m_scale*2.0;
352  dKui*=m_scale*2.0;
353 
354  // compute R=2*dKui-dKuui*B
355  MatrixXd R=2*dKui-dKuui*eigen_B;
356 
357  // compute v=ddiagKi-sum(R.*B, 1)'
358  VectorXd v=ddiagKi-R.cwiseProduct(eigen_B).colwise().sum().adjoint();
359 
360  SGVector<float64_t> result(1);
361 
362  // compute dnlZ=(ddiagKi'*(1./g_sn2)+w'*(dKuui*w-2*(dKui*al))-al'*(v.*al)-
363  // sum(W.*W,1)*v- sum(sum((R*W').*(B*W'))))/2;
364  result[0]=(ddiagKi.dot(VectorXd::Ones(m_dg.vlen).cwiseQuotient(eigen_dg))+
365  eigen_w.dot(dKuui*eigen_w-2*(dKui*eigen_al))-
366  eigen_al.dot(v.cwiseProduct(eigen_al))-
367  eigen_W.cwiseProduct(eigen_W).colwise().sum().dot(v)-
368  (R*eigen_W.adjoint()).cwiseProduct(eigen_B*eigen_W.adjoint()).sum())/2.0;
369 
370  return result;
371 }
372 
374  const TParameter* param)
375 {
376  REQUIRE(!strcmp(param->m_name, "sigma"), "Can't compute derivative of "
377  "the nagative log marginal likelihood wrt %s.%s parameter\n",
378  m_model->get_name(), param->m_name)
379 
380  // create eigen representation of dg, al, w, W and B
381  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
382  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
383  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
384  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
385  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
386 
387  // get the sigma variable from the Gaussian likelihood model
389  float64_t sigma=lik->get_sigma();
390  SG_UNREF(lik);
391 
392  SGVector<float64_t> result(1);
393 
394  result[0]=CMath::sq(sigma)*(VectorXd::Ones(m_dg.vlen).cwiseQuotient(
395  eigen_dg).sum()-eigen_W.cwiseProduct(eigen_W).sum()-eigen_al.dot(eigen_al));
396 
397  float64_t dKuui=2.0*m_ind_noise;
398  MatrixXd R=-dKuui*eigen_B;
399  VectorXd v=-R.cwiseProduct(eigen_B).colwise().sum().adjoint();
400 
401  result[0]=result[0]+((eigen_w.dot(dKuui*eigen_w))-eigen_al.dot(
402  v.cwiseProduct(eigen_al))-eigen_W.cwiseProduct(eigen_W).colwise().sum().dot(v)-
403  (R*eigen_W.adjoint()).cwiseProduct(eigen_B*eigen_W.adjoint()).sum())/2.0;
404 
405  return result;
406 }
407 
409  const TParameter* param)
410 {
411  // create eigen representation of dg, al, w, W, B
412  Map<VectorXd> eigen_dg(m_dg.vector, m_dg.vlen);
413  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
414  Map<VectorXd> eigen_w(m_w.vector, m_w.vlen);
415  Map<MatrixXd> eigen_W(m_W.matrix, m_W.num_rows, m_W.num_cols);
416  Map<MatrixXd> eigen_B(m_B.matrix, m_B.num_rows, m_B.num_cols);
417 
418  SGVector<float64_t> result;
419 
420  if (param->m_datatype.m_ctype==CT_VECTOR ||
421  param->m_datatype.m_ctype==CT_SGVECTOR)
422  {
424  "Length of the parameter %s should not be NULL\n", param->m_name)
425  result=SGVector<float64_t>(*(param->m_datatype.m_length_y));
426  }
427  else
428  {
429  result=SGVector<float64_t>(1);
430  }
431 
432  for (index_t i=0; i<result.vlen; i++)
433  {
434  SGVector<float64_t> deriv_trtr;
435  SGMatrix<float64_t> deriv_uu;
436  SGMatrix<float64_t> deriv_tru;
437 
438  if (result.vlen==1)
439  {
442 
443  m_kernel->init(m_latent_features, m_latent_features);
444  deriv_uu=m_kernel->get_parameter_gradient(param);
445 
446  m_kernel->init(m_latent_features, m_features);
447  deriv_tru=m_kernel->get_parameter_gradient(param);
448  }
449  else
450  {
452  deriv_trtr=m_kernel->get_parameter_gradient(param, i).get_diagonal_vector();
453 
454  m_kernel->init(m_latent_features, m_latent_features);
455  deriv_uu=m_kernel->get_parameter_gradient(param, i);
456 
457  m_kernel->init(m_latent_features, m_features);
458  deriv_tru=m_kernel->get_parameter_gradient(param, i);
459  }
460 
461  m_kernel->cleanup();
462 
463  // create eigen representation of derivatives
464  Map<VectorXd> ddiagKi(deriv_trtr.vector, deriv_trtr.vlen);
465  Map<MatrixXd> dKuui(deriv_uu.matrix, deriv_uu.num_rows,
466  deriv_uu.num_cols);
467  Map<MatrixXd> dKui(deriv_tru.matrix, deriv_tru.num_rows,
468  deriv_tru.num_cols);
469 
470  ddiagKi*=CMath::sq(m_scale);
471  dKuui*=CMath::sq(m_scale);
472  dKui*=CMath::sq(m_scale);
473 
474  // compute R=2*dKui-dKuui*B
475  MatrixXd R=2*dKui-dKuui*eigen_B;
476 
477  // compute v=ddiagKi-sum(R.*B, 1)'
478  VectorXd v=ddiagKi-R.cwiseProduct(eigen_B).colwise().sum().adjoint();
479 
480  // compute dnlZ=(ddiagKi'*(1./g_sn2)+w'*(dKuui*w-2*(dKui*al))-al'*
481  // (v.*al)-sum(W.*W,1)*v- sum(sum((R*W').*(B*W'))))/2;
482  result[i]=(ddiagKi.dot(VectorXd::Ones(m_dg.vlen).cwiseQuotient(eigen_dg))+
483  eigen_w.dot(dKuui*eigen_w-2*(dKui*eigen_al))-
484  eigen_al.dot(v.cwiseProduct(eigen_al))-
485  eigen_W.cwiseProduct(eigen_W).colwise().sum().dot(v)-
486  (R*eigen_W.adjoint()).cwiseProduct(eigen_B*eigen_W.adjoint()).sum())/2.0;
487  }
488 
489  return result;
490 }
491 
493  const TParameter* param)
494 {
495  // create eigen representation of al vector
496  Map<VectorXd> eigen_al(m_al.vector, m_al.vlen);
497 
498  SGVector<float64_t> result;
499 
500  if (param->m_datatype.m_ctype==CT_VECTOR ||
501  param->m_datatype.m_ctype==CT_SGVECTOR)
502  {
504  "Length of the parameter %s should not be NULL\n", param->m_name)
505 
506  result=SGVector<float64_t>(*(param->m_datatype.m_length_y));
507  }
508  else
509  {
510  result=SGVector<float64_t>(1);
511  }
512 
513  for (index_t i=0; i<result.vlen; i++)
514  {
516 
517  if (result.vlen==1)
519  else
521 
522  Map<VectorXd> eigen_dmu(dmu.vector, dmu.vlen);
523 
524  // compute dnlZ=-dm'*al
525  result[i]=-eigen_dmu.dot(eigen_al);
526  }
527 
528  return result;
529 }
530 
531 #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 void cleanup()
Definition: Kernel.cpp:147
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:244
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
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:425
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:1336

SHOGUN Machine Learning Toolbox - Documentation