17 using namespace shogun;
49 use_bias = mch->use_bias;
67 void COnlineLibLinear::init()
91 diag[0]=0;diag[1]=0;diag[2]=0;
92 upper_bound[0]=Cn;upper_bound[1]=0;upper_bound[2]=Cp;
108 SG_INFO(
"Optimization finished.\n")
111 for (int32_t i=0; i<
w_dim; i++)
115 SG_INFO(
"Objective value = %lf\n", v/2)
128 QD = diag[y_current + 1];
145 C = upper_bound[y_current + 1];
146 G += alpha_current*diag[y_current + 1];
149 if (alpha_current == 0)
158 else if (alpha_current == C)
173 if (fabs(PG) > 1.0e-12)
177 d = (alpha_current - alpha_old) * y_current;
179 for (int32_t i=0; i <
w_dim; ++i)
187 v += alpha_current*(alpha_current*diag[y_current + 1] - 2);
188 if (alpha_current > 0)
197 SG_ERROR(
"Expected streaming dense feature <float32_t>\n")
static float64_t dot(const bool *v1, const bool *v2, int32_t n)
compute dot product between v1 and v2 (blas optimized)
Class OnlineLinearMachine is a generic interface for linear machines like classifiers which work thro...
static const float64_t INFTY
infinity
SGVector< 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()
static T max(T a, T b)
return the maximum of two integers
Streaming features that support dot products among other operations.
Class implementing a purely online version of LibLinear, using the L2R_L1LOSS_SVC_DUAL solver only...
CStreamingDotFeatures * features
static T min(T a, T b)
return the minimum of two integers
virtual void start_train()