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

Method mainLoop

JSAT/src/jsat/classifiers/svm/LSSVM.java:489–526  ·  view source on GitHub ↗
(DataSet dataSet, LSSVM warmSolution, double[] targets, ExecutorService ex)

Source from the content-addressed store, hash-verified

487 }
488
489 private void mainLoop(DataSet dataSet, LSSVM warmSolution, double[] targets, ExecutorService ex)
490 {
491 final int P;
492 if(ex == null || ex instanceof FakeExecutor)
493 {
494 ex = new FakeExecutor();
495 P = 1;
496 }
497 else
498 P = SystemInfo.LogicalCores;
499
500 try
501 {
502 vecs = dataSet.getDataVectors();
503 initializeVariables(targets, warmSolution, dataSet);
504
505 boolean change = true;
506 double dualityGap = computeDualityGap(true, ex, P);
507 int iter = 0;
508 while (dualityGap > tol * dualObjective && change)
509 {
510 change = takeStep(i_up, i_low, ex, P);
511 dualityGap = computeDualityGap(true, ex, P);
512 iter++;
513 }
514
515 setCacheMode(null);
516 setAlphas(alphas);
517 }
518 catch (InterruptedException interruptedException)
519 {
520 throw new FailedToFitException(interruptedException);
521 }
522 catch (ExecutionException executionException)
523 {
524 throw new FailedToFitException(executionException);
525 }
526 }
527
528 /**
529 * Guess the distribution to use for the regularization term

Callers 2

trainMethod · 0.95
trainCMethod · 0.95

Calls 6

initializeVariablesMethod · 0.95
computeDualityGapMethod · 0.95
takeStepMethod · 0.95
getDataVectorsMethod · 0.80
setCacheModeMethod · 0.80
setAlphasMethod · 0.45

Tested by

no test coverage detected