Nu is infeasible

15.6k views Asked by At

I am using the NuSVC class in sklearn. After trying to instantiate an NuSVC object as follows:

self.classifier = OneVsRestClassifier(NuSVC())

I found that I repeatedly get a 'specified nu is infeasible' error. I tried varying the 'nu' parameter from 0.1 all the way to 1. (in 0.1 increments), but I keep getting the same error. I am really unsure how to interpret this message, and how to go about resolving it? I figured that if I set the nu to 1., it would work because nu represents an upper bound on the fraction of training errors which I believe should always be tenable. What could be causing this?

Thanks for the help!

2

There are 2 answers

3
eickenberg On

For completeness, from the documentation: Nu-SVM is a constrained formulation of SVM (equivalent with the original up to reparametrization) which poses a hard bound on the allowed misclassification. If this bound cannot by satisfied, then the associated convex optimization problem becomes infeasible.

From this standpoint the first thing you have to investigate is how much training error you really can expect, and maybe revise your assumptions. Search over a grid of C values for a standard SVM to check that.

NuSVC should work with some values strictly less than 1, though. According to your description, you have tried 0.9 -- start adding 9s, ie .99, .999. If it doesn't work at some point, then there has to be another problem somewhere.

0
Erik On

Proposition 3 in the paper A tutorial on ν-support vector machines, states that there is an upper bound on feasible values for nu, given by 2*min(m+,m-)/m, where m is the total number of samples and m+ and m- are the number of samples in the respective class.

Thus, if nu is infeasible, try a smaller nu.