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)
| 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 |