Nu is infeasible

MEric picture MEric · Nov 18, 2014 · Viewed 11.2k times · Source

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!

Answer

eickenberg picture eickenberg · Nov 18, 2014

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.