Error value occurs when using GridSearchCV

I use GridSearchCV for classification, and my codes are:

parameter_grid_SVM = {'dual':[True,False],
                    'loss':["squared_hinge","hinge"],
                    'penalty':["l1","l2"] 
                    }
clf = GridSearchCV(LinearSVC(),param_grid=parameter_grid_SVM,verbose=2)
clf.fit(trian_data, labels)

And then I meet a mistake

ValueError: unsupported set of arguments: penalty = 'l1' is supported only with double = 'false'., Parameters: penalty = 'l1', loss = 'hinge', dual = False

Subsequently, I change my code to:

clf = GridSearchCV(LinearSVC(penalty='l1',dual=False),verbose=2)

And I meet a mistake

TypeError: init () takes at least 3 arguments (3 data)

I also tried:

parameter_grid_SVM = {
                    'loss':["squared_hinge"]
                    }
clf = GridSearchCV(LinearSVC(penalty='l1',dual=False),param_grid=parameter_grid_SVM,verbose=2)
clf.fit(trian_data, labels)

However, I still have a mistake

ValueError: unsupported set of arguments: punce = 'l1' is only supported if double = 'false'., Parameters: pun = 'l1', loss = 'squared_hinge', dual = False

Does anyone have an idea what should I do to handle this?

+4
3

SVM. - SVM. , .

clf = LinearSVC(loss='l2', penalty='l1', dual=False)

+1

, , . , , , , - , = 'l1', dual = 'false'.

0

- GridSearchCV , error_score. . .

0

Source: https://habr.com/ru/post/1584955/


All Articles