52 use_bias = mch->use_bias;
70 void COnlineLibLinear::init()
88 diag[0]=0;diag[1]=0;diag[2]=0;
89 upper_bound[0]=Cn;upper_bound[1]=0;upper_bound[2]=Cp;
117 diag[0]=0;diag[1]=0;diag[2]=0;
118 upper_bound[0]=Cn;upper_bound[1]=0;upper_bound[2]=Cp;
129 SG_INFO(
"Optimization finished.\n")
132 for (int32_t i=0; i<
w_dim; i++)
136 SG_INFO(
"Objective value = %lf\n", v/2)
144 int32_t y_current = 0;
150 QD = diag[y_current + 1];
162 C = upper_bound[y_current + 1];
163 G += alpha_current*diag[y_current + 1];
166 if (alpha_current == 0)
175 else if (alpha_current == C)
190 if (fabs(PG) > 1.0e-12)
194 d = (alpha_current - alpha_old) * y_current;
196 for (int32_t i=0; i <
w_dim; ++i)
204 v += alpha_current*(alpha_current*diag[y_current + 1] - 2);
205 if (alpha_current > 0)
212 int32_t y_current = 0;
218 QD = diag[y_current + 1];
230 C = upper_bound[y_current + 1];
231 G += alpha_current*diag[y_current + 1];
234 if (alpha_current == 0)
243 else if (alpha_current == C)
258 if (fabs(PG) > 1.0e-12)
262 d = (alpha_current - alpha_old) * y_current;
272 v += alpha_current*(alpha_current*diag[y_current + 1] - 2);
273 if (alpha_current > 0)
285 SG_ERROR(
"Expected streaming dense feature <float32_t>\n")
293 SG_ERROR(
"Expected streaming sparse feature <float32_t>\n")
Class OnlineLinearMachine is a generic interface for linear machines like classifiers which work thro...
T sparse_dot(const SGSparseVector< T > &v)
static const float64_t INFTY
infinity
SGVector< T > get_vector()
#define SG_NOTIMPLEMENTED
SGSparseVector< T > get_vector()
virtual void train_one(SGVector< float32_t > ex, float64_t label)
virtual void stop_train()
virtual void set_features(CStreamingDotFeatures *feat)
virtual void train_example(CStreamingDotFeatures *feature, float64_t label)
void add(bool *param, const char *name, const char *description="")
virtual ~COnlineLibLinear()
virtual void expand_if_required(float32_t *&vec, int32_t &len)
virtual EFeatureClass get_feature_class() const =0
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.
SGSparseVectorEntry< T > * features
T dense_dot(T alpha, T *vec, int32_t dim, T b)
all of classes and functions are contained in the shogun namespace
Class implementing a purely online version of CLibLinear, using the L2R_L1LOSS_SVC_DUAL solver only...
CStreamingDotFeatures * features
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry* vector is orde...
This class implements streaming features with sparse feature vectors. The vector is represented as an...
virtual void start_train()