39 void CKernelRidgeRegression::init()
46 bool CKernelRidgeRegression::train_machine_pinv()
54 for(int32_t i=0; i < n; i++)
55 kernel_matrix.matrix[i+i*n]+=m_tau;
66 SG_ERROR(
"Number of labels does not match number of kernel"
67 " columns (num_labels=%d cols=%d\n",
m_alpha.
vlen, n);
70 clapack_dposv(CblasRowMajor,CblasUpper, n, 1, kernel_matrix.
matrix, n,
76 bool CKernelRidgeRegression::train_machine_gs()
96 SG_ERROR(
"Number of labels does not match number of kernel"
97 " columns (num_labels=%d cols=%d\n",
m_alpha.
vlen, n);
106 for(int32_t i=0; i<n; i++)
109 for(int32_t j=0; j<n; j++)
131 SG_ERROR(
"Real labels needed for kernel ridge regression.\n")
136 SG_ERROR(
"Number of training vectors does not match number of labels\n")
141 switch (m_train_func)
144 return train_machine_pinv();
147 return train_machine_gs();
150 return train_machine_pinv();
virtual bool init(CFeatures *lhs, CFeatures *rhs)
SGVector< int32_t > m_svs
virtual ELabelType get_label_type() const =0
Real Labels are real-valued labels.
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_labels() const =0
real valued labels (e.g. for regression, classifier outputs)
virtual int32_t get_num_vectors() const =0
float64_t kernel(int32_t idx_a, int32_t idx_b)
A generic KernelMachine interface.
virtual int32_t get_num_vec_lhs()
SGMatrix< float64_t > get_kernel_matrix()
SGVector< float64_t > m_alpha
virtual int32_t get_num_vec_rhs()
or gauss-seidel iterative method
virtual bool save(FILE *dstfile)
SGVector< float64_t > get_alphas()
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
void set_kernel(CKernel *k)
virtual bool train_machine(CFeatures *data=NULL)
virtual bool has_features()
virtual void set_labels(CLabels *lab)
virtual bool load(FILE *srcfile)