There are many steps when building a machine learning model, such as:
- Dealing with missing data;
- Converting categorical features into dummies (or other type of encoding);
- Splitting into train and test;
- Applying StandardScale (or other type of scaling/normalization).
What is the correct order?
Additionally, if I have missing in the test features, should I apply the same mean/median (or other missing imputation) used in the training data? I mean, if the missing column in training data has mean of 5, should I imput 5 in the test data?
I read this question: https://datascience.stackexchange.com/questions/53138/which-comes-first-multiple-imputation-splitting-into-train-test-or-standardiz, but it is not complete. Also, it is not the same order as this post is https://towardsdatascience.com/logistic-regression-a-simplified-approach-using-python-c4bc81a87c31, and not sure if is the same of this one https://towardsdatascience.com/handling-missing-data-for-a-beginner-6d6f5ea53436