Abhishek
Abhishek

Reputation: 157

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

I tried creating a SVM Classifier, as:

# 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
            )

(Using Python 2.7)

But getting this error--

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

Any thoughts on that will be very useful. Cheers!

Upvotes: 1

Views: 13354

Answers (1)

Abhishek
Abhishek

Reputation: 157

I did upgrade my sklearn to version 0.18. Earlier it was 0.16.1 and as @coryKramer suggested-- decision_function_shape argument was only added in versions 0.17+.

So I followed his suggestion and upgraded and now everything is working just fine.

Meanwhile, here's how to upgrade from cmd in Windows, using pip.

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

Upvotes: 2

Related Questions