2
votes

I am using scikitlearn to train a SVM. I was wondering it would be possible to pause training every so often to test the current model's accuracy on my validation set. Ultimately I want to generate a validation accuracy curve. using .Fit() trains an SVM all the way through but that just gives me one accuracy data point at the end

1

1 Answers

0
votes

There is a little trick you can use actually.

You can play on the parameter max_iter of your SVC classifier. For instance, you can get multiple classifiers with different number of iterations.

Here is what you can do :

import numpy as np

for i in np.arange(10, 1000, 100):
    svm = SVC(max_iter=i) # and your other parameters
    svm.fit(X, y)
    ... # here retrieve your metrics

Doing so will show you how the classifier performs at different level of the training.