TypeError: __init__() got an unexpected keyword argument 'decision_function_shape'

TypeError: __init__() got an unexpected keyword argument 'decision_function_shape'

我尝试创建一个 SVM 分类器,如:

# Create a SVM Classifier
model = SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
            decision_function_shape=None, degree=3, gamma='auto', kernel='linear',
            max_iter=-1, probability=True, random_state=None, shrinking=True,
            tol=0.001, verbose=False
            )

(使用Python 2.7)

但是出现这个错误--

TypeError: init() got an unexpected keyword argument 'decision_function_shape'

对此的任何想法都会非常有用。干杯!

我确实将 sklearn 升级到了 version 0.18。早些时候它是 0.16.1 并且正如@coryKramer 所建议的那样—— decision_function_shape 参数仅在 0.17+ 版本中添加。

所以我按照他的建议进行了升级,现在一切正常。

同时,这里是如何使用 pip 从 Windows 中的 cmd 升级。

pip install scikit-learn==0.18 --force-reinstall