301 RealMatrix &budgetAlpha = budgetModel.
alpha();
306 const double lambda = 1.0 / (ell *
m_C);
307 std::size_t iterations;
312 iterations = std::max(10 * ell, std::size_t (std::ceil(
m_C * ell)));
323 budgetAlpha(j, c) = 1 / (1 + lambda);
324 budgetAlpha(j, (c + 1) % classes) = -1 / (1 + lambda);
336 RealVector predictions(classes, 0.0);
337 RealVector derivative(classes, 0.0);
343 for(std::size_t iter = 0; iter < iterations; iter++)
361 RealVector predictionsCopy = predictions;
362 unsigned int trueClass = y[b];
363 double scoreOfTrueClass = predictions[trueClass];
364 predictions[trueClass] = -std::numeric_limits<double>::infinity();
365 unsigned int runnerupClass = (
unsigned int)arg_max(predictions);
366 double scoreOfRunnerupClass = predictions[runnerupClass];
371 budgetModel.
alpha() *= ((
long double)(1.0 - 1.0 / (iter + 1.0)));
374 if(scoreOfTrueClass - scoreOfRunnerupClass <
m_minMargin)
384 predictions[trueClass] = 1.0 / ((
long double)(iter + 1.0) * lambda);
387 predictions[runnerupClass] = -1.0 / ((
long double)(iter + 1.0) * lambda);