73 SG_ERROR(
"Specified features are not of type CStreamingDotFeatures\n")
94 t = 1 / (eta0 * lambda);
96 SG_INFO(
"lambda=%f, epochs=%d, eta0=%f\n", lambda, epochs, eta0)
106 bool is_log_loss =
false;
125 if (z < 1 || is_log_loss)
132 if (use_regularized_bias)
133 bias *= 1 - eta * lambda * bscale;
134 bias += etd * y * bscale;
142 r = pow(1 - eta * lambda, skip);
191 if (n>=max_vec_num || m > 1000)
195 SG_PRINT(
"Online SGD calibrated using %d vectors.\n", n)
201 skip = (int32_t) ((16 * n * c_dim) / r);
203 SG_INFO(
"using %d examples. skip=%d bscale=%.6f\n", n, skip, bscale)
208 void COnlineSVMSGD::init()
221 use_regularized_bias=
false;
234 m_parameters->
add(&use_bias,
"use_bias",
"Indicates if bias is used.");
235 m_parameters->
add(&use_regularized_bias,
"use_regularized_bias",
"Indicates if bias is regularized.");
Class OnlineLinearMachine is a generic interface for linear machines like classifiers which work thro...
Class CLossFunction is the base class of all loss functions.
virtual void start_parser()=0
virtual void reset_stream()
virtual float32_t dense_dot(const float32_t *vec2, int32_t vec2_len)=0
void calibrate(int32_t max_vec_num=1000)
static void scale_vector(T alpha, T *vec, int32_t len)
Scale vector inplace.
virtual void set_features(CStreamingDotFeatures *feat)
void add(bool *param, const char *name, const char *description="")
virtual bool get_next_example()=0
virtual ELossType get_loss_type()=0
static void clear_cancel()
void set_loss_function(CLossFunction *loss_func)
virtual bool train(CFeatures *data=NULL)
virtual void expand_if_required(float32_t *&vec, int32_t &len)
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
Compute dot product between v1 and v2 (blas optimized)
Streaming features that support dot products among other operations.
static bool cancel_computations()
virtual void add_to_dense_vec(float32_t alpha, float32_t *vec2, int32_t vec2_len, bool abs_val=false)=0
all of classes and functions are contained in the shogun namespace
virtual void end_parser()=0
CStreamingDotFeatures * features
The class Features is the base class of all feature objects.
virtual void release_example()=0
virtual float64_t get_label()=0
CHingeLoss implements the hinge loss function.
virtual int32_t get_nnz_features_for_vector()
virtual bool get_has_labels()
virtual float64_t first_derivative(float64_t prediction, float64_t label)
virtual bool is_seekable()
bool has_property(EFeatureProperty p) const
ELossType
shogun loss type