14 using namespace shogun;
17 :
CSVM(), model(NULL), solver_type(st)
22 :
CSVM(C, k, lab), model(NULL), solver_type(LIBSVM_C_SVC)
34 struct svm_node* x_space;
42 SG_ERROR(
"Number of training vectors does not match number of labels\n");
53 SG_ERROR(
"Number of training vectors does not match length of linear term\n");
63 for (
int i=0; i!=
problem.l; i++)
73 for (int32_t i=0; i<
problem.l; i++)
78 x_space[2*i+1].index=-1;
81 int32_t weights_label[2]={-1,+1};
88 param.kernel_type = LINEAR;
101 param.weight_label = weights_label;
102 param.weight = weights;
105 const char* error_msg = svm_check_parameter(&
problem, &
param);
117 int32_t num_sv=
model->l;
126 for (int32_t i=0; i<num_sv; i++)
140 svm_destroy_model(
model);
virtual bool init(CFeatures *lhs, CFeatures *rhs)
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_vectors() const =0
virtual int32_t get_num_vec_lhs()
LIBSVM_SOLVER_TYPE solver_type
virtual float64_t * get_linear_term_array()
SGVector< float64_t > m_linear_term
void set_bias(float64_t bias)
bool set_alpha(int32_t idx, float64_t val)
void set_objective(float64_t v)
virtual bool train_machine(CFeatures *data=NULL)
float64_t get_label(int32_t idx)
bool set_support_vector(int32_t idx, int32_t val)
bool is_two_class_labeling()
The class Features is the base class of all feature objects.
A generic Support Vector Machine Interface.
CLibSVM(LIBSVM_SOLVER_TYPE st=LIBSVM_C_SVC)
virtual bool has_features()
#define SG_MALLOC(type, len)
bool create_new_model(int32_t num)