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

Method getSupportClassGoal

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

Part A of SPA algorithm @param xNorm the value of the squared 2 norm training input @param k the value of k @param loss_k the loss of the k'th sorted value @return the target support class goal to be less than

(final double xNorm, final int k, final double loss_k)

Source from the content-addressed store, hash-verified

189 * @return the target support class goal to be less than
190 */
191 private double getSupportClassGoal(final double xNorm, final int k, final double loss_k)
192 {
193 if(mode == PassiveAggressive.Mode.PA1)
194 return min((k-1)*loss_k+C*xNorm, k*loss_k);
195 else if(mode == PassiveAggressive.Mode.PA2)
196 return ((k*xNorm+(k-1)/(2*C))/(xNorm+1.0/(2*C)))*loss_k;
197 else
198 return k*loss_k;
199 }
200
201 /**
202 * Part B of SPA algorithm

Callers 1

updateMethod · 0.95

Calls 1

minMethod · 0.45

Tested by

no test coverage detected