20 using namespace Eigen;
38 void CKernelRidgeRegression::init()
52 kernel_matrix(i,i) +=
m_tau;
54 Map<MatrixXd> eigen_kernel_matrix(kernel_matrix.matrix, n, n);
59 llt.compute(eigen_kernel_matrix);
60 if (llt.info() != Eigen::Success)
62 SG_WARNING(
"Features covariance matrix was not positive definite\n");
65 eigen_alphas = llt.solve(eigen_y);
75 SG_ERROR(
"Real labels needed for kernel ridge regression.\n")
80 SG_ERROR(
"Number of training vectors does not match number of labels\n")
87 SG_ERROR(
"Number of labels does not match number of kernel"
virtual bool init(CFeatures *lhs, CFeatures *rhs)
SGVector< int32_t > m_svs
void range_fill(T start=0)
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 bool solve_krr_system()
virtual int32_t get_num_vectors() const =0
A generic KernelMachine interface.
SGMatrix< float64_t > get_kernel_matrix()
SGVector< float64_t > m_alpha
virtual int32_t get_num_vec_rhs()
virtual bool save(FILE *dstfile)
all of classes and functions are contained in the shogun namespace
void set_alphas(SGVector< float64_t > alphas)
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)