16 using namespace shogun;
24 :
CSVM(C, k, lab), model(NULL)
44 SG_ERROR(
"Number of training vectors does not match number of labels\n");
52 SG_INFO(
"%d trainlabels\n", prob.ell);
58 prob.preprocess_size = -1;
59 prob.projection_projector = -1;
64 if (prob.chunk_size < 2) prob.chunk_size = 2;
65 if (prob.q <= 0) prob.q = prob.chunk_size / 3;
66 if (prob.q < 2) prob.q = 2;
67 if (prob.q > prob.chunk_size) prob.q = prob.chunk_size;
68 prob.q = prob.q & (~1);
73 SG_INFO(
"\nTRAINING PARAMETERS:\n");
74 SG_INFO(
"\tNumber of training documents: %d\n", prob.ell);
75 SG_INFO(
"\tq: %d\n", prob.chunk_size);
77 SG_INFO(
"\tC: %lf\n", prob.c_const);
78 SG_INFO(
"\tkernel type: %d\n", prob.ker_type);
79 SG_INFO(
"\tcache size: %dMb\n", prob.maxmw);
80 SG_INFO(
"\tStopping tolerance: %lf\n", prob.delta);
83 if (prob.preprocess_size == -1)
84 prob.preprocess_size = (int32_t) ( (
float64_t)prob.chunk_size * 1.5 );
86 if (prob.projection_projector == -1)
88 if (prob.chunk_size <= 20) prob.projection_projector = 0;
89 else prob.projection_projector = 1;
94 prob.gpdtsolve(solution);
104 for (i = 0; i < prob.ell; i++)
106 if (solution[i] > prob.DELTAsv)
109 if (solution[i] > (prob.c_const - prob.DELTAsv)) bsv++;
116 SG_INFO(
"SV: %d BSV = %d\n", num_sv, bsv);
118 for (i = 0; i < prob.ell; i++)
120 if (solution[i] > prob.DELTAsv)
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 bool train_machine(CFeatures *data=NULL)
virtual void free_vector()
SGVector< int32_t > get_int_labels()
void set_bias(float64_t bias)
bool set_alpha(int32_t idx, float64_t val)
void set_objective(float64_t v)
float64_t get_label(int32_t idx)
bool set_support_vector(int32_t idx, int32_t val)
bool is_two_class_labeling()
bool get_linadd_enabled()
The class Features is the base class of all feature objects.
A generic Support Vector Machine Interface.
#define SG_MALLOC(type, len)
bool create_new_model(int32_t num)