Question with Box Cox transformation

I’m not sure if I could use boxcox transofmation for normalization. If I can, here is how I’m writing for the transformation part:

from scipy.stats import boxcox
def boxcoxtrans(df):
df = df.copy(deep=True)
trans, lambda_value = boxcox(df[“FTSE_Small”])
df[“FTSE_Small_boxcox”] = trans
return df

When I apply this function to X_train:
X_train = boxcoxtrans(X_train)
I will get the lambda_value associated with this transformation.

Do I use this lambda_value to transform X_test? Also, later when I’m using the transformed data for Deep Learning Bianry Classification, do I need to tranform the data back to the original scale? Or simply passing the transformed data to deep learning is fine?

I am a little confused. Hopefully I have expressed myself clear enough.

Hi, you are right, then you use the lambda for the test set (to prevent leakage), and we only transform back into the original shape if we are transforming the labels, and not the features (sorry for getting back to you a little late).

If you are using box cox to over come normality or non-constant variance, the only time you would want to return the data to the original scale is after modeling is complete and making predictions