0
$\begingroup$

I did ANN classification using SMOTE random sampling in python but I found strange plot loss and accuracy results. This is my code:

#With SMOTE
sm = SMOTE(random_state=42)
Train_X2_Smote, Train_Y2_Smote = sm.fit_resample(Train_X2_Tfidf, Train_Y2)

#TRIAL 4
def reset_seeds():
   np.random.seed(0) 
   python_random.seed(0)
   tf.random.set_seed(0)

reset_seeds() 

model4 = Sequential()
model4.add(Dense(10, input_dim= Train_X2_Smote.shape[1], activation='sigmoid'))
model4.add(Dense(1, activation='sigmoid'))
opt = Adam (learning_rate=0.001)
model4.compile(loss='binary_crossentropy', optimizer=opt, metrics=['accuracy'])
model4.summary()

es = EarlyStopping(monitor="val_loss",mode='min',patience=10)
history4 = model4.fit(Train_X2_Smote, Train_Y2_Smote, epochs=1000, verbose=1, 
                      validation_split=0.2, batch_size=32, callbacks =[es])

resulting loss and accuracy graph: enter image description here

is there anything have to fix in my code?

$\endgroup$
4
  • $\begingroup$ Why do you want to run SMOTE for your modeling? $\endgroup$
    – Dave
    Commented Jun 1, 2023 at 1:18
  • $\begingroup$ @Dave I did a review classification and the amount of data is not balanced between positive and negative (positive 3x more than negative) $\endgroup$
    – Andryan
    Commented Jun 1, 2023 at 1:25
  • $\begingroup$ What’s the problem you see with the lack of balance? $\endgroup$
    – Dave
    Commented Jun 1, 2023 at 1:40
  • $\begingroup$ @Dave nothing, in fact the plot is more normal than this. But I want to compare what if not using random oversampling and using $\endgroup$
    – Andryan
    Commented Jun 1, 2023 at 1:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.