12 #include <shogun/lib/external/gpdt.h>
13 #include <shogun/lib/external/gpdtsolve.h>
25 :
CSVM(C, k, lab), model(NULL)
45 SG_ERROR(
"Number of training vectors does not match number of labels\n")
53 SG_INFO(
"%d trainlabels\n", prob.ell)
59 prob.preprocess_size = -1;
60 prob.projection_projector = -1;
65 if (prob.chunk_size < 2) prob.chunk_size = 2;
66 if (prob.q <= 0) prob.q = prob.chunk_size / 3;
67 if (prob.q < 2) prob.q = 2;
68 if (prob.q > prob.chunk_size) prob.q = prob.chunk_size;
69 prob.q = prob.q & (~1);
74 SG_INFO(
"\nTRAINING PARAMETERS:\n")
75 SG_INFO(
"\tNumber of training documents: %d\n", prob.ell)
76 SG_INFO(
"\tq: %d\n", prob.chunk_size)
78 SG_INFO(
"\tC: %lf\n", prob.c_const)
79 SG_INFO(
"\tkernel type: %d\n", prob.ker_type)
80 SG_INFO(
"\tcache size: %dMb\n", prob.maxmw)
81 SG_INFO(
"\tStopping tolerance: %lf\n", prob.delta)
84 if (prob.preprocess_size == -1)
85 prob.preprocess_size = (int32_t) ( (
float64_t)prob.chunk_size * 1.5 );
87 if (prob.projection_projector == -1)
89 if (prob.chunk_size <= 20) prob.projection_projector = 0;
90 else prob.projection_projector = 1;
94 solution = SG_MALLOC(
float64_t, prob.ell);
95 prob.gpdtsolve(solution);
105 for (i = 0; i < prob.ell; i++)
107 if (solution[i] > prob.DELTAsv)
110 if (solution[i] > (prob.c_const - prob.DELTAsv)) bsv++;
117 SG_INFO(
"SV: %d BSV = %d\n", num_sv, bsv)
119 for (i = 0; i < prob.ell; i++)
121 if (solution[i] > prob.DELTAsv)
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
virtual bool train_machine(CFeatures *data=NULL)
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)
all of classes and functions are contained in the shogun namespace
bool get_linadd_enabled()
The class Features is the base class of all feature objects.
A generic Support Vector Machine Interface.
Binary Labels for binary classification.
bool create_new_model(int32_t num)