MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / update

Method update

JSAT/src/jsat/classifiers/linear/kernelized/ALMA2K.java:225–248  ·  view source on GitHub ↗
(DataPoint dataPoint, int targetClass)

Source from the content-addressed store, hash-verified

223 }
224
225 @Override
226 public void update(DataPoint dataPoint, int targetClass)
227 {
228 final Vec x_t = dataPoint.getNumericalValues();
229 final double y_t = targetClass*2-1;
230
231 double gamma = B * Math.sqrt(p-1) / k;
232 double wx = score(x_t, false);
233 if(y_t*wx <= (1-alpha)*gamma)//update
234 {
235 double eta = C/Math.sqrt(p-1)/Math.sqrt(k++);
236
237 double norm = Math.sqrt(K.eval(x_t, x_t));
238
239 associatedScores.add(score(new ScaledVector(1/norm, x_t), false));
240 supports.add(x_t);
241 normalizers.add(norm);
242 signedEtas.add(eta*y_t);
243 rounds.add(curRounds);
244 curRounds = 0;
245 }
246 else
247 curRounds++;
248 }
249
250 /**
251 * Computes the output of the summations of the input vector with the

Callers

nothing calls this directly

Calls 4

scoreMethod · 0.95
getNumericalValuesMethod · 0.80
evalMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected