19 using namespace shogun;
46 SG_ERROR(
"Specified features are not of type CDotFeatures\n");
59 struct options Options;
61 struct vector_double Weights;
62 struct vector_double Outputs;
69 Data.Y=train_labels.
vector;
74 Options.lambda=1/(2*
get_C1());
75 Options.lambda_u=1/(2*
get_C1());
79 Options.cgitermax=10000;
80 Options.mfnitermax=50;
89 for (int32_t i=0;i<num_vec;i++)
91 if(train_labels.
vector[i]>0)
96 ssl_train(&Data, &Options, &Weights, &Outputs);
97 ASSERT(Weights.vec && Weights.d==num_feat+1);
100 for (int32_t i=0; i<num_feat+1; i++)
bool has_property(EFeatureProperty p)
SGVector< float64_t > get_labels()
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_vectors() const =0
void set_w(SGVector< float64_t > src_w)
Features that support dot products among other operations.
virtual int32_t get_dim_feature_space() const =0
virtual void free_vector()
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
virtual bool train_machine(CFeatures *data=NULL)
The class Features is the base class of all feature objects.
virtual void set_features(CDotFeatures *feat)
void set_bias(float64_t b)
virtual void set_labels(CLabels *lab)
#define SG_MALLOC(type, len)
void ssl_train(struct data *Data, struct options *Options, struct vector_double *Weights, struct vector_double *Outputs)