# Python / Keras: SMOTE and validation_split

I try to train a MLP with an imbalanced dataset. I'd like to use SMOTE to balance my classes; as highlighted here (https://beckernick.github.io/oversampling-modeling/), the class rebalancing should always be done after splitting into train / test set, because otherwise information from the test set will "spill" the training set.

In addition to having a test set, however, I would like to use a validation set by means of the validation_split parameter. Is it safe to use this after having applied SMOTE? Or should I rather split the data first into training, validation and test sets and insert the validation set via the validation_data parameter to the fit function?

• Validation set should also be independent if present, so apply SMOTE after splitting. – user2974951 Feb 7 at 12:41

Please take a look at this argument class_weight in fit method.
fit(x=None, y=None, batch_size=None, epochs=1, verbose=1, callbacks=None,