I am following the example shown in http://scikit-learn.org/stable/auto_examples/svm/plot_oneclass.html#example-svm-plot-oneclass-py, where a one class SVM is used for anomaly detection. Now, this may be a notation unique to scikit-learn, but I couldn't find an explanation of how to use the parameter nu given to the OneClassSVM constructor.
In http://scikit-learn.org/stable/modules/svm.html#nusvc, it is stated that the parameter nu is a reparametrization of the parameter C (which is the regularization parameter which I am familiar with) - but doesn't state how to perform that reparameterization.
Both a formula and an intuition will be much appreciated.
Thanks!
According to this link, nu specifies the nu parameter for the one-class SVM model. The nu parameter is both a lower bound for the number of samples that are support vectors and an upper bound for the number of samples that are on the wrong side of the hyperplane. The default is 0.1.
The nu-support vector classifier (Nu-SVC) is similar to the SVC with the only difference that the nu-SVC classifier has a nu parameter to control the number of support vectors. In this tutorial, we'll briefly learn how to classify data by using Scikit-learn's NuSVC class in Python.
Based on support vector machines method, Nu Support Vector Regression (NuSVR) is an algorithm to solve the regression problems. The NuSVR algorithm applies nu parameter by replacing the the epsilon parameter of SVR method.
The C parameter tells the SVM optimization how much you want to avoid misclassifying each training example. For large values of C, the optimization will choose a smaller-margin hyperplane if that hyperplane does a better job of getting all the training points classified correctly.
The problem with the parameter C is:
It is therefore hard to choose correctly and one has to resort to cross validation or direct experimentation to find a suitable value.
In response Schölkopf et al. reformulated SVM to take a new regularization parameter nu. This parameter is:
The parameter nu is an upper bound on the fraction of margin errors and a lower bound of the fraction of support vectors relative to the total number of training examples. For example, if you set it to 0.05 you are guaranteed to find at most 5% of your training examples being misclassified (at the cost of a small margin, though) and at least 5% of your training examples being support vectors.
The relation between C and nu is governed by the following formula:
nu = A+B/C
A and B are constants which are unfortunately not that easy to calculate.
The takeaway message is that C and nu SVM are equivalent regarding their classification power. The regularization in terms of nu is easier to interpret compared to C, but the nu SVM is usually harder to optimize and runtime doesn't scale as well as the C variant with number of input samples.
More details (including formulas for A and B) can be found here: Chang CC, Lin CJ - "Training nu-support vector classifiers: theory and algorithms"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With