42 SG_ERROR(
"Specified features are not of type CDotFeatures\n")
55 memset(tmp_w, 0,
sizeof(
float64_t)*num_feat);
61 for (int32_t i=0; i<num_feat; i++)
71 for (int32_t i=0; i<num_vec; i++)
75 if (CMath::sign<float64_t>(output[i]) != train_labels.
vector[i])
84 for (int32_t j=0; j<num_feat; j++)
92 SG_INFO(
"Averaged Perceptron algorithm converged after %d iterations.\n", iter)
94 SG_WARNING(
"Averaged Perceptron algorithm did not converge after %d iterations.\n",
max_iter)
97 for (int32_t i=0; i<num_feat; i++)
98 w[i]=tmp_w[i]/(num_vec*iter);
99 bias=tmp_bias/(num_vec*iter);
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
virtual ~CAveragedPerceptron()
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
virtual void set_features(CDotFeatures *feat)
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
SG_FORCED_INLINE bool cancel_computation() const
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
virtual bool train_machine(CFeatures *data=NULL)
Binary Labels for binary classification.
bool has_property(EFeatureProperty p) const
virtual void set_labels(CLabels *lab)