Scikit-learn GridSearch giving “ValueError: multiclass format is not supported” error

后端 未结 3 1383
-上瘾入骨i
-上瘾入骨i 2021-02-07 12:06

I\'m trying to use GridSearch for parameter estimation of LinearSVC() as follows -

clf_SVM = LinearSVC()
params = {
          \'C\': [0.5, 1.0, 1.5],
          \         


        
3条回答
  •  野性不改
    2021-02-07 12:38

    from:

    http://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_auc_score.html#sklearn.metrics.roc_auc_score

    "Note: this implementation is restricted to the binary classification task or multilabel classification task in label indicator format."

    try:

    from sklearn import preprocessing
    y = preprocessing.label_binarize(y, classes=[0, 1, 2, 3])
    

    before you train. this will perform a "one-hot" encoding of your y.

提交回复
热议问题