j13r
j13r

Reputation: 2671

Update SVM classifier with new data

I trained a SVM classifier in Python using

clf = sklearn.svm.NuSVC(nu=0.05, probability=True, kernel='rbf')
clf.fit(points, classes)

And that works great for predictions. Now I want to update the classifiers parameters. Few points change classifications (from positive number to zero), and a few are added. Few means 50 of 10000 or more.

I thought it would be smart to nevertheless hint the SVM classifier to start at the previous parameters, which should be very close to the best solution. I have the problem that sometimes, the classifier is randomly very poor (fitting failed I presume). Is there a way to do so in scikit-learn or libsvm?

Upvotes: 2

Views: 1767

Answers (1)

Fred Foo
Fred Foo

Reputation: 363547

NuSVC does not offer incremental/online learning. To do that in scikit-learn, you need SGDClassifier. That fits a linear model, but you can get an approximation to the RBF kernel with the kernel_approximations module (see also its author's blog).

If you want a true online kernel learner, check out LASVM.

Upvotes: 5

Related Questions