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());
130 kernel->
init(feat, data);
137 eigen_Ks*=
CMath::sq(m_method->get_scale());
152 if (eigen_L.isUpperTriangular())
159 MatrixXd eigen_V=eigen_L.triangularView<Upper>().adjoint().solve(
160 eigen_sW.asDiagonal()*eigen_Ks);
161 MatrixXd eigen_sV=eigen_V.cwiseProduct(eigen_V);
163 eigen_s2=eigen_Kss.diagonal()-eigen_sV.colwise().sum().adjoint();
168 MatrixXd eigen_M=eigen_Ks.cwiseProduct(eigen_L*eigen_Ks);
169 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.
all of classes and functions are contained in the shogun namespace
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)