I have a dataset where my target variable is a number between 1 and 8. Now I am going to implement Cubic SVM.
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
from sklearn.svm import SVC
model1 = SVC(kernel='poly', degree=3)
model1.fit(X_train, y_train)
y_prob = model1.predict(X_test)
y_true = np.argmax(y_prob, axis=0)
auc = roc_auc_score(y_test, y_true, multi_class='ovr')
Now to get AUC, the following error is observed:
TypeError: Singleton array array(1) cannot be considered a valid collection.
How to solve this error?
y_proband noty_true.y_true = np.argmax(y_prob, axis=0)instead - please look again at your code!