Nonsensical Confusion Matrix for ANN

Viewed 45

I have used the following methods to attempt to create an ANN model. However, my classification matrix (at the bottom) strongly indicates something has gone amiss. However, I am not sure where the problem started and why. The dataset I used was split as such:

X = df.drop('Recurrence', axis = 1)
y = df['Recurrence']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.3, random_state = 0)
print(X_train.shape)
print(y_train.shape)
print(X_test.shape)
print(y_test.shape)

This was the train/test method:

from sklearn.neural_network import MLPClassifier
from sklearn.model_selection import train_test_split

# Set seed for reproducibility
SEED = 1

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)

clf = MLPClassifier(hidden_layer_sizes=(100), activation='logistic', solver='lbfgs', learning_rate= 'adaptive',
                    random_state=SEED, max_iter=200).fit(X_train, y_train)

classificationSummary(y_train, clf.predict(X_train))
classificationSummary(y_test, clf.predict(X_test))

The following classification summary was given

       Confusion Matrix (Accuracy 1.0000)

       Prediction
       Actual 0
              0 1
       Confusion Matrix (Accuracy 0.0000)

       Prediction
        Actual 0 1
             0 0 1
             1 0 0
0 Answers
Related