I have recently started using kaggle and I have stumbled on a few examples of practices I would consider do be data leakage. Many of them were done by people well established on the platform and I could tell by their notebooks, that they knew what they were doing.
As some examples I have seen someone fix skewness on the whole dataset before any train-test split. As another I have seen multiple people impute missing data not only based on the whole dataset, but also taking into consideration the labels of the observations. So they imputed one value for one class and another for the second class. Why? Is this not data leakage? Shouldn't practices like this be avoided? Am I missing something here?
I have found this question, but I don't believe it is applicable in the cases I wrote about, since the final goal of all the notebooks was to create predictive models.
I realized that a log transformation would be fine to apply to the whole dataset, when fixing skewness, but that is not the case in the example I was talking about. The transformation applied was box-cox.
The specific transformations in the examples about imputation were all filling the missing values with the means of features with respect to the class labels.