[scikit-learn] NuSVC and ValueError: specified nu is infeasible

Piotr Bialecki piotr.bialecki at hotmail.de
Thu Dec 8 02:56:37 EST 2016


Hi Thomas,

the doc says, that nu gives an upper bound on the fraction of training errors and a lower bound of the fractions
of support vectors.
http://scikit-learn.org/stable/modules/generated/sklearn.svm.NuSVC.html

Therefore, it acts as a hard bound on the allowed misclassification on your dataset.

To me it seems as if the error bound is not feasible.
How well did the SVC perform? What was your training error there?

Will the NuSVC converge when you skip the sample_weights?


Greets,
Piotr

On 08.12.2016 00:07, Thomas Evangelidis wrote:
Greetings,

I want  to  use the Nu-Support Vector Classifier with the following input data:

X= [
array([  3.90387012,   1.60732281,  -0.33315799,   4.02770896,
         1.82337731,  -0.74007214,   6.75989219,   3.68538903,
         ..................
         0.        ,  11.64276776,   0.        ,   0.        ]),
array([  3.36856769e+00,   1.48705816e+00,   4.28566992e-01,
         3.35622071e+00,   1.64046508e+00,   5.66879661e-01,
         .....................
         4.25335335e+00,   1.96508829e+00,   8.63453394e-06]),
 array([  3.74986249e+00,   1.69060713e+00,  -5.09921270e-01,
         3.76320781e+00,   1.67664455e+00,  -6.21126735e-01,
         ..........................
         4.16700259e+00,   1.88688784e+00,   7.34729942e-06]),
.......
]

and

Y=  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ............................
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]


​Each array of X contains 60 numbers and the dataset consists of 48 positive and 1230 negative observations. When I train an svm.SVC() classifier I get quite good predictions, but wit the ​svm.NuSVC​() I keep getting the following error no matter which value of nu in [0.1, ..., 0.9, 0.99, 0.999, 0.9999] I try:
/usr/local/lib/python2.7/dist-packages/sklearn/svm/base.pyc in fit(self, X, y, sample_weight)
    187
    188         seed = rnd.randint(np.iinfo('i').max)
--> 189         fit(X, y, sample_weight, solver_type, kernel, random_seed=seed)
    190         # see comment on the other call to np.iinfo in this file
    191
/usr/local/lib/python2.7/dist-packages/sklearn/svm/base.pyc in _dense_fit(self, X, y, sample_weight, solver_type, kernel, random_seed)
    254                 cache_size=self.cache_size, coef0=self.coef0,
    255                 gamma=self._gamma, epsilon=self.epsilon,
--> 256                 max_iter=self.max_iter, random_seed=random_seed)
    257
    258         self._warn_from_fit_status()
/usr/local/lib/python2.7/dist-packages/sklearn/svm/libsvm.so in sklearn.svm.libsvm.fit (sklearn/svm/libsvm.c:2501)()
ValueError: specified nu is infeasible

​
​Does anyone know what might be wrong? Could it be the input data?

thanks in advance for any advice
Thomas​



--

======================================================================

Thomas Evangelidis

Research Specialist

CEITEC - Central European Institute of Technology
Masaryk University
Kamenice 5/A35/1S081,
62500 Brno, Czech Republic


email: tevang at pharm.uoa.gr<mailto:tevang at pharm.uoa.gr>

          tevang3 at gmail.com<mailto:tevang3 at gmail.com>

website: https://sites.google.com/site/thomasevangelidishomepage/




_______________________________________________
scikit-learn mailing list
scikit-learn at python.org<mailto:scikit-learn at python.org>
https://mail.python.org/mailman/listinfo/scikit-learn


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20161208/d948f7c9/attachment-0001.html>


More information about the scikit-learn mailing list