17 #define INDEX(ROW,COL,DIM) (((COL)*(DIM))+(ROW))
42 SG_ERROR(
"Number of training vectors does not match number of labels\n")
47 SG_INFO(
"%d trainlabels\n", num_data)
50 for (int32_t i=0; i<num_data; i++)
58 SG_ERROR(
"label unknown (%f)\n", lab)
62 int32_t tmax=1000000000;
71 for(int32_t i=0; i<num_data; i++) {
77 memset(vector_c, 0, num_data*
sizeof(
float64_t));
87 npp.
gnpp_imdm(diagK, vector_c, vector_y, num_data,
88 tmax, tolabs, tolrel, thlb, alpha, &t, &aHa11, &aHa22,
95 for(int32_t i = 0; i < num_data; i++ )
97 if( alpha[i] != 0 ) num_sv++;
100 alpha[i] = alpha[i]*2/nconst;
101 if( alpha[i]/(2*C) >= 1 ) trnerr++;
105 alpha[i] = -alpha[i]*2/nconst;
106 if( alpha[i]/(2*C) <= -1 ) trnerr++;
110 float64_t b = 0.5*(aHa22 - aHa11)/nconst;;
117 for (int32_t i=0; i<num_data; i++)
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
class GNPPLib, a Library of solvers for Generalized Nearest Point Problem (GNPP). ...
virtual int32_t get_num_vectors() const =0
float64_t kernel(int32_t idx_a, int32_t idx_b)
#define INDEX(ROW, COL, DIM)
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
The class Features is the base class of all feature objects.
A generic Support Vector Machine Interface.
int8_t gnpp_imdm(float64_t *diag_H, float64_t *vector_c, float64_t *vector_y, int32_t dim, int32_t tmax, float64_t tolabs, float64_t tolrel, float64_t th, float64_t *alpha, int32_t *ptr_t, float64_t *ptr_aHa11, float64_t *ptr_aHa22, float64_t **ptr_History, int32_t verb)
Binary Labels for binary classification.
virtual bool train_machine(CFeatures *data=NULL)
bool create_new_model(int32_t num)