why do we use the same StandardScaler object on both the test and train data(x_train and x_test) , wouldn't this lead to data leakage between the x_train and x_test data set ?
Using .fit_transform() method on x_train calculates the mean of x_train ,and by using the same object for x_test , the standardisation is done using the mean calculated for x_train