StandardScaler Process

I was looking at the StandardScaler code in Week2/Lab3. Specifically the StandardScaler code in the train_and_get_metrics function. What is the correct process for transforming the Test set? I read through some of the Scikit-Learn pages and the code here looks slightly different. I’m intentionally leaving this question open ended.

Thank you in advance.


Transformation parameters (eg. mean and standard deviation in the case of StandardScaler) are learnt from the training dataset via call to the .fit method. The .transform method is used to create a new dataset by applying the learnt parameters on the provided dataset. Since we want to scale X_train and X_test, there are 2 calls.

Hope this helps.