18 :
CSVM(), model(NULL), solver_type(LIBSVM_C_SVC)
23 :
CSVM(), model(NULL), solver_type(st)
29 :
CSVM(C, k, lab), model(NULL), solver_type(st)
41 struct svm_node* x_space;
50 SG_ERROR(
"%s::train_machine(): Number of training vectors (%d) does"
51 " not match number of labels (%d)\n",
get_name(),
64 SG_ERROR(
"Number of training vectors does not match length of linear term\n")
74 for (
int i=0; i!=
problem.l; i++)
82 x_space=SG_MALLOC(
struct svm_node, 2*
problem.l);
84 for (int32_t i=0; i<
problem.l; i++)
89 x_space[2*i+1].index=-1;
92 int32_t weights_label[2]={-1,+1};
101 param.svm_type=C_SVC;
104 param.svm_type=NU_SVC;
111 param.kernel_type = LINEAR;
124 param.weight_label = weights_label;
125 param.weight = weights;
128 const char* error_msg = svm_check_parameter(&
problem, &
param);
140 int32_t num_sv=
model->l;
149 for (int32_t i=0; i<num_sv; i++)
163 svm_destroy_model(
model);
virtual bool init(CFeatures *lhs, CFeatures *rhs)
virtual ELabelType get_label_type() const =0
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_labels() const =0
virtual int32_t get_num_vectors() const =0
float64_t m_max_train_time
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)
bool set_support_vector(int32_t idx, int32_t val)
virtual const char * get_name() const
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
A generic Support Vector Machine Interface.
Binary Labels for binary classification.
virtual bool has_features()
bool create_new_model(int32_t num)