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* training_kernel=m_method->get_kernel();
70 kernel->
init(feat, data);
77 eigen_Ks*=
CMath::sq(m_method->get_scale());
85 Map<VectorXd> eigen_alpha(alpha.
vector, alpha.
vlen);
96 eigen_mu=eigen_Ks.adjoint()*eigen_alpha+eigen_m;
104 REQUIRE(m_method,
"Inference method should not be NULL\n")
109 if (m_method->get_inference_type()==
INF_FITC)
117 feat=m_method->get_features();
122 CKernel* training_kernel=m_method->get_kernel();
126 kernel->
init(data, data);
133 eigen_Kss*=
CMath::sq(m_method->get_scale());
136 kernel->
init(feat, data);
143 eigen_Ks*=
CMath::sq(m_method->get_scale());
158 if (eigen_L.isUpperTriangular())
165 MatrixXd eigen_V=eigen_L.triangularView<Upper>().adjoint().solve(
166 eigen_sW.asDiagonal()*eigen_Ks);
167 MatrixXd eigen_sV=eigen_V.cwiseProduct(eigen_V);
169 eigen_s2=eigen_Kss.diagonal()-eigen_sV.colwise().sum().adjoint();
174 MatrixXd eigen_M=eigen_Ks.cwiseProduct(eigen_L*eigen_Ks);
175 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.
virtual CSGObject * clone()
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.
static CKernel * obtain_from_generic(CSGObject *kernel)
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)