(DataSet dataSet, LSSVM warmSolution, double[] targets, ExecutorService ex)
| 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 |
no test coverage detected