20 :
CLinearMachine(), learn_rate(0.1), max_iter(1000), m_initialize_hyperplane(true)
43 SG_ERROR(
"Specified features are not of type CDotFeatures\n")
58 if (m_initialize_hyperplane)
63 for (int32_t i=0; i<num_feat; i++)
73 for (int32_t i=0; i<num_vec; i++)
77 if (CMath::sign<float64_t>(output[i]) != train_labels.
vector[i])
89 SG_INFO(
"Perceptron algorithm converged after %d iterations.\n", iter)
102 m_initialize_hyperplane = initialize_hyperplane;
107 return m_initialize_hyperplane;
virtual ELabelType get_label_type() const =0
virtual void set_w(const SGVector< float64_t > src_w)
The class Labels models labels, i.e. class assignments of objects.
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)=0
bool has_property(EFeatureProperty p) const
bool get_initialize_hyperplane()
get if the hyperplane should be initialized
virtual int32_t get_num_vectors() const =0
virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false)=0
Features that support dot products among other operations.
virtual int32_t get_dim_feature_space() const =0
static void clear_cancel()
void set_initialize_hyperplane(bool initialize_hyperplane)
set if the hyperplane should be initialized
virtual void set_features(CDotFeatures *feat)
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
static bool cancel_computations()
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
virtual SGVector< float64_t > get_w() const
virtual bool train_machine(CFeatures *data=NULL)
Binary Labels for binary classification.
virtual void set_labels(CLabels *lab)