问题描述
我在sklearn中使用NuSVC类.尝试实例化NuSVC对象后,如下所示:
I am using the NuSVC class in sklearn. After trying to instantiate an NuSVC object as follows:
self.classifier = OneVsRestClassifier(NuSVC())
我发现我反复收到指定的nu是不可行的"错误.我尝试将'nu'参数从0.1一直更改为1(以0.1为增量),但是我仍然遇到相同的错误.我真的不确定如何解释此消息,以及如何解决它?我认为,如果将nu设置为1,那将是可行的,因为nu代表了训练误差部分的上限,我认为该误差应该始终成立.可能是什么原因造成的?
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?
感谢您的帮助!
推荐答案
为完整起见,从文档中获得:Nu-SVM是SVM的一种受约束的表述(等同于原始的直到重新参数化),对允许的错误分类提出了严格的要求.如果无法满足此界限,则相关的凸优化问题将变得不可行.
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.
从这个角度出发,您需要调查的第一件事是您真正可以预期到多少训练错误,并可能会修改您的假设.在C
值的网格中搜索标准SVM进行检查.
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应该使用一些严格小于1的值.根据您的描述,您尝试过0.9-开始添加9,即.99,.999.如果在某些时候不起作用,那么某处必须存在另一个问题.
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.
这篇关于Nu是不可行的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!