35 struct svm_model* model =
nullptr;
43 struct svm_node* x_space;
44 SG_INFO(
"%d train data points\n", problem.l)
47 problem.x=SG_MALLOC(
struct svm_node*, problem.l);
48 x_space=SG_MALLOC(
struct svm_node, 2*problem.l);
50 for (int32_t i=0; i<problem.l; i++)
52 problem.x[i]=&x_space[2*i];
54 x_space[2*i+1].index=-1;
57 int32_t weights_label[2]={-1,+1};
60 param.svm_type=ONE_CLASS;
61 param.kernel_type = LINEAR;
74 param.weight_label = weights_label;
75 param.weight = weights;
78 const char* error_msg = svm_check_parameter(&problem,¶m);
83 model = svm_train(&problem, ¶m);
88 ASSERT((model->l==0) || (model->l>0 && model->SV && model->sv_coef && model->sv_coef[0]))
90 int32_t num_sv=model->l;
96 for (int32_t i=0; i<num_sv; i++)
104 svm_destroy_model(model);
virtual bool init(CFeatures *lhs, CFeatures *rhs)
float64_t m_max_train_time
virtual int32_t get_num_vec_lhs()
int32_t cache_size
cache_size in MB
void set_bias(float64_t bias)
bool set_alpha(int32_t idx, float64_t val)
void set_objective(float64_t v)
bool set_support_vector(int32_t idx, int32_t val)
virtual ~CLibSVMOneClass()
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.
virtual bool train_machine(CFeatures *data=NULL)
bool create_new_model(int32_t num)