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

Thomas Evangelidis tevang3 at gmail.com
Wed Dec 7 18:07:35 EST 2016


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

          tevang3 at gmail.com


website: https://sites.google.com/site/thomasevangelidishomepage/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20161208/89c38073/attachment.html>


More information about the scikit-learn mailing list