SVM optimizer fails with large matrix
2 views (last 30 days)
I am trying to optimize a binary SVM, but when I use all the data (10 Gb aproximmately), the optimization figures show up but nothing happens (over the course of days). The computer has enough memory (it shows a 25% usage) and CPU (it shows a 20% usage), so it is not a problem of running out of resources. I believe it may have entered some sort of internal loop, because when I only use 1% of the information, it works fine. Is there some step I'm missing? thanks for your time.
cvp = cvpartition(response, 'Holdout', 0.2);
trainingPredictors = predictors(cvp.training, :);
trainingResponse = response(cvp.training, :);
validationPredictors = predictors(cvp.test, :);
validationResponse = response(cvp.test, :);
% Train model
MdlT= fitcsvm(trainingPredictors, ...
Don Mathis on 10 Jan 2020
My guess is that it is trying to fit an SVm using the first set of hyperparameters it tried, and it's taking a long time. Try putting 'Verbose',2 inside the struct and it will display the hyperparameters it is about to try next. Then you can try passing those explicitly and see if takes a long time using those values.
>> load ionosphere
Performing function evaluation on point: 64.836 | 0.0015729 |
Time to select the next point: 0.09863
Time to fit the model(s): 0.05019
| Iter | Eval | Objective | Objective | BestSoFar | BestSoFar | BoxConstraint| KernelScale |
| | result | | runtime | (observed) | (estim.) | | |
| 1 | Best | 0.38571 | 3.539 | 0.38571 | 0.38571 | 64.836 | 0.0015729 |
Performing function evaluation on point: 0.036335 | 5.5755 |
Time to select the next point: 0.096786
Time to fit the model(s): 0.034137
| 2 | Best | 0.35714 | 0.034081 | 0.35714 | 0.35892 | 0.036335 | 5.5755 |
Performing function evaluation on point: 0.0022147 | 0.0023957 |
Notice that the first iteration took 100 times longer than the second, because of the hyperparameter values used. You can then run those values manually to check the runtime by itself:
>> tic; fitcsvm(X,Y,'BoxConstraint',64.836,'KernelScale',.0015729,'Holdout',.2); toc
Elapsed time is 3.365133 seconds.