I am using GridSearchCV to do 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 the error
ValueError: Unsupported set of arguments: penalty='l1' is only supported when dual='false'., Parameters: penalty='l1', loss='hinge', dual=False
later on I change my code to :
clf = GridSearchCV(LinearSVC(penalty='l1',dual=False),verbose=2)
And I meet the error
TypeError: init() takes at least 3 arguments (3 given)
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 the error
ValueError: Unsupported set of arguments: penalty='l1' is only supported when dual='false'., Parameters: penalty='l1', loss='squared_hinge', dual=False
Anyone has idea what I should do to deal with that?