I have seen few post related to this question but i am not quite clear about my confusions as mention bellow.
I have some confusion related to fit and fit_transform.
suppose, I have X_train and X_test data, and let my scaling function is standard scalar.
I am using following code for scaling,
X_train = sc_X.fit_transform(X_train)
X_test = sc_X.fit_transform`
My question is, if i use same scalar on bot trainin and testing data, wont it creat problem of data leakage?
What if I use the code like below,
X_train = sc_X_train.fit_transform(X_train)
X_test = sc_X_test.fit_transform(X_test)
Does the both code give different results?