0
$\begingroup$

Please help me to understand which of the following is correct and why.

  1. X_train, X_test : Split the training set into training and test sets
  2. X_train_std : Standardize X_train
  3. X_train_res : Oversample X_train_std
  4. model.fit : Train the model using X_train_res
  5. X_test_std : Standardize X_test using the parameters calculated in 2)
  6. model.evaluate : Evaluate the model using X_test_std

Or:

  1. X_train, X_test : Split the training set into training and test sets
  2. X_train_std : Standardize X_train
  3. X_train_res : Oversample X_train_std
  4. X_train_res_std : Standardize X_train_res
  5. model.fit : Train the model using X_train_res_std
  6. X_test_std : Standardize X_test using the parameters calculated in 4)
  7. model.evaluate : Evaluate the model using X_test_std
$\endgroup$
0
$\begingroup$

Let's discuss the second variant:

If a standardization is considered as a function f(data) and the second standardization after oversampling is considered as a function g(f(data)), then you should use the same transformation for your test data. However, in the second option you just implement the function g(data) without transformation the data using function f().

Therefor, it seems to me, that the first variant is better. Moreover, it is enough to standardize data just once, so the first option is ok.

$\endgroup$
  • $\begingroup$ Thanks! In the first case the data used to train the model (X_train_res) is not standardized. So, why should we standardize X_test using the parameters found by standardizing X_train? $\endgroup$ – malwr Jul 28 at 13:46
  • $\begingroup$ Data is standardized (2) and then oversampled (3) in the first case, as I can see. So, you train standardized data. $\endgroup$ – Lana Jul 29 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.