1

I trained my model with MLP classifier which is available on SkLearn.

I split the data using the code

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

The X_train length = 9405
Class distribution for y_train = 0: 7562, 1: 1843
X_test length = 4032
class distribution on y_test = 0: 3242, 1: 790

The code for the MLP classifier is

MLP = MLPClassifier(random_state=1, learning_rate = "constant", learning_rate_init=0.3, momentum = 0.2 )
MLP.fit(X_train, y_train)
R_y_pred = MLP.predict(X_test)
target_names = ['No', 'Yes']
print(classification_report(y_test, R_y_pred, target_names=target_names, zero_division=0))

zero_division= 0 has been included to the classification report because it was suggested from my previous question Precision, recall, F1 score all have zero value for the minority class in the classification report. The error of my previous question was rectified however the classification report that I got using the above code it seems not correct. The classifier failed to classify Yes class (minority class) and classify all classes as No class

The classification report looks like

                 precision    recall  f1-score   support

            No       0.80      1.00      0.89      3242
            Yes       0.00      0.00      0.00       790

       accuracy                           0.80      4032
      macro avg       0.40      0.50      0.45      4032
   weighted avg       0.65      0.80      0.72      4032

The problem only occurred for SVM and MLP classifiers. The model trained well with random forest and logistic regression. The dataset is a categorical dataset that is label encoded.

Any suggestion should be appreciated

Encipher
  • 1,370
  • 1
  • 14
  • 31

0 Answers0