Is Winsorization performed on test data as well? I know what is Winsorization and why is it applied. My understanding was that it is applied only on the train data to reduce the effect of outliers.
But! Recently I came across a kernel where Min, Max (or 99th percentile values) from training data are stored and applied on the test data before applying the model. Is it the right way to test model? What is common practice?
Please comment if something is not clear! I will be happy to elaborate more.
 A: So, after talking to some experts, it is common practice to apply Winsorization to test data as well.
Which means this the full process of building the model.


*

*Split the data into train and test sets.

*Apply Winsorization on train data (of course, when necessary!!) and save the values (i.e. 99th or 95th or Xth percentile).

*Before applying the model to test data, you have to apply Winsorization to test data as well (using the values saved from train data).

*Apply the model to test data and measure model performance.

A: They key here is to imagine that you are going to deploy your final model and use it: your training data represents the data you will have before you deploy your model and the test data represents the data you will obtain after you deploy your model.
So you will do exactly the same modifications to your test data as you do to your training data. If you use the square root of wind speed, you will always take the square root of the wind speed before using it. It wouldn't make any sense to use, say, the log of the wind speed or the raw wind speed when using your model if you trained it on the square root.
Step #4 in your self-answer is an important detail. You use the winsorization cutoffs that you calculated with your training data. If you winsorize all of your data and then partition it into training and testing, you are allowing the "future" data (test) to influence your cut-off values which is impossible. Since you won't know the future when you actually use your model, you can't use data manipulations that are affected by the test (future) data.
