26 using namespace shogun;
44 void CGaussianProcessRegression::init()
54 SG_ADD((
CSGObject**) &m_method,
"inference_method",
"Inference Method.",
58 void CGaussianProcessRegression::update_kernel_matrices()
72 kernel->
init(latent_features, m_data);
74 kernel->
init(m_data, m_data);
82 m_k_trts(i,j) *= (m_scale*m_scale);
85 kernel->
init(m_data, m_data);
92 m_k_tsts(i,j) *= (m_scale*m_scale);
111 get_first_feature_obj();
114 SG_ERROR(
"Specified features are not of type CFeatures\n");
117 SG_ERROR(
"Expected Simple Features\n");
120 SG_ERROR(
"Expected Real Features\n");
128 SG_ERROR(
"Specified features are not of type CFeatures\n");
131 SG_ERROR(
"Expected Simple Features\n");
134 SG_ERROR(
"Expected Real Features\n");
140 update_kernel_matrices();
147 update_kernel_matrices();
175 for (
index_t i = 0; i < size; i++)
177 if (i < mean_vector.
vlen)
178 result_vector[i] = mean_vector[i];
180 result_vector[i] = cov_vector[i-mean_vector.
vlen];
208 get_first_feature_obj())->
209 get_computed_dot_feature_matrix();
215 get_computed_dot_feature_matrix();
219 SG_ERROR(
"Mean function is NULL!\n");
227 cblas_dgemv(CblasColMajor, CblasTrans, m_k_trts.
num_rows,
233 result_vector[i] += means[i];
242 return result_vector;
254 if (diagonal.
vlen > 0)
267 temp1(j,i) = diagonal[i]*m_k_trts(j,i);
270 for (
index_t i = 0; i < diagonal2.vlen; i++)
273 memcpy(temp2.
matrix, m_L.matrix,
274 m_L.num_cols*m_L.num_rows*
sizeof(
float64_t));
285 clapack_dgetrs(CblasColMajor, CblasNoTrans,
290 for (
index_t i = 0; i < temp1.num_rows; i++)
292 for (
index_t j = 0; j < temp1.num_cols; j++)
293 temp1(i,j) = temp1(i,j)*temp1(i,j);
296 for (
index_t i = 0; i < temp1.num_cols; i++)
300 for (
index_t j = 0; j < temp1.num_rows; j++)
301 diagonal2[i] += temp1(j,i);
309 result[i] = m_k_tsts(i,i) - diagonal2[i];
331 cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, m_L.
num_rows,
339 temp1(i,j) *= m_k_trts(i,j);
355 result[i] = m_k_tsts(i,i) + temp3[i];