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

Method getStepSize

JSAT/src/jsat/classifiers/linear/SPA.java:209–217  ·  view source on GitHub ↗

Part B of SPA algorithm @param loss_cur the loss for the current value in consideration @param xNorm the value of the squared 2 norm training input @param k the value of k (number of support classes +1) @param supLossSum the sum of the loss for the support classes @return the update step size

(final double loss_cur, final double xNorm, int k, final double supLossSum)

Source from the content-addressed store, hash-verified

207 * @return the update step size
208 */
209 private double getStepSize(final double loss_cur, final double xNorm, int k, final double supLossSum)
210 {
211 if(mode == PassiveAggressive.Mode.PA1)
212 return max(0, loss_cur-max(supLossSum/(k-1)-C/(k-1)*xNorm, supLossSum/k))/xNorm;
213 else if(mode == PassiveAggressive.Mode.PA2)
214 return max(0, loss_cur-(xNorm+1/(2*C))/(k*xNorm+(k-1)/(2*C))*supLossSum )/xNorm;
215 else
216 return max(0, loss_cur-supLossSum/k)/xNorm;
217 }
218
219 @Override
220 public void update(DataPoint dataPoint, int targetClass)

Callers 1

updateMethod · 0.95

Calls 1

maxMethod · 0.45

Tested by

no test coverage detected