21 using namespace shogun;
22 using namespace Eigen;
32 set_inference_method(method);
35 void CGaussianProcessMachine::init()
50 REQUIRE(m_method,
"Inference method should not be NULL\n")
55 if (m_method->get_inference_type()==
INF_FITC)
63 feat=m_method->get_features();
66 CKernel* kernel=m_method->get_kernel();
67 kernel->
init(feat, data);
74 eigen_Ks*=
CMath::sq(m_method->get_scale());
82 Map<VectorXd> eigen_alpha(alpha.
vector, alpha.
vlen);
93 eigen_mu=eigen_Ks.adjoint()*eigen_alpha+eigen_m;
101 REQUIRE(m_method,
"Inference method should not be NULL\n")
106 if (m_method->get_inference_type()==
INF_FITC)
114 feat=m_method->get_features();
119 CKernel* kernel=m_method->get_kernel();
120 kernel->
init(data, data);
127 eigen_Kss*=
CMath::sq(m_method->get_scale());
132 kernel->
init(feat, data);
139 eigen_Ks*=
CMath::sq(m_method->get_scale());
154 if (eigen_L.isUpperTriangular())
161 MatrixXd eigen_V=eigen_L.triangularView<Upper>().adjoint().solve(
162 eigen_sW.asDiagonal()*eigen_Ks);
163 MatrixXd eigen_sV=eigen_V.cwiseProduct(eigen_V);
165 eigen_s2=eigen_Kss.diagonal()-eigen_sV.colwise().sum().adjoint();
170 MatrixXd eigen_M=eigen_Ks.cwiseProduct(eigen_L*eigen_Ks);
171 eigen_s2=eigen_Kss.diagonal()+eigen_M.colwise().sum().adjoint();
CGaussianProcessMachine()
virtual bool init(CFeatures *lhs, CFeatures *rhs)
virtual CFeatures * get_latent_features()
The Inference Method base class.
SGVector< float64_t > get_posterior_variances(CFeatures *data)
SGVector< float64_t > get_posterior_means(CFeatures *data)
virtual SGVector< float64_t > get_mean_vector(const CFeatures *features) const =0
An abstract class of the mean function.
SGMatrix< float64_t > get_kernel_matrix()
Class SGObject is the base class of all shogun objects.
The class Features is the base class of all feature objects.
The Fully Independent Conditional Training inference method class.
virtual ~CGaussianProcessMachine()
static CFITCInferenceMethod * obtain_from_generic(CInferenceMethod *inference)