Using Python 2.7, I am trying to carry out grid searches for AUC and accuracy scores for a SVC model. I get the error as outlined below.
Attempted to troubleshoot to no avail.
clf = SVC(kernel = 'rbf')
parameter_grid = [
{'C': [0.1, 1, 10, 50, 100, 400],
'gamma': [0.0001, 0.001, 0.01, 0.1, 1, 10]}
]
clf_stand_acc = GridSearchCV(clf, param_grid = parameter_grid)
clf_stand_acc.fit(X_train, y_train)
y_predict_auc = clf_stand_acc.predict(X_test)
clf_stand_auc = GridSearchCV(clf, param_grid = parameter_grid, scoring = 'roc_auc')
clf_stand_auc.fit(X_train, y_train)
y_predict_auc = clf_stand_auc.predict(X_test)
print('Test of AUC: ', roc_auc_score(y_test, y_predict_auc))
Expected something like the following output. Test set AUC: 0.9993784757585
Snippet of the actual output below.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-47-ef06600e0bf8> in <module>()
19 # Generate an auc object with the classifier and grid parameters.
20 clf_stand_auc = GridSearchCV(clf, param_grid = parameter_grid, scoring = 'roc_auc')
---> 21 clf_stand_auc.fit(X_train, y_train)
22 y_predict_auc = clf_stand_auc.predict(X_test)
23
ValueError: Data is not binary and pos_label is not specified