Im trying to make a confusion matrix to determine how well my model performed. I split my model into x and y testing and training set however, to make my confusion matrix, I need the y_test data(the predicted data) and the actual data. Is there a way I can see the actual results of the y_test data. Heres a little snippet of my cod:
x_train, x_test, y_train, y_test = train_test_split(a, yy, test_size=0.2, random_state=1)
model = MultinomialNB() #don forget these brackets here
model.fit(x_train,y_train.ravel())
#CONFUSION MATRIX
confusion = confusion_matrix(y_test, y_test)
print(confusion)
print(len(y_test))
Your y_test
is the actual data and the results from the predict
method will be the predicted data.
y_pred = model.predict(x_test)
confusion = confusion_matrix(y_test, y_pred)