In the cv.glmnet function, there is an option to automatically standardize the data. If you select this, how does the predict function scale the test data?
Example:
cvob1 = cv.glmnet(x_train, y, standardize = TRUE)
# Note standardize = TRUE is the default option and just added here for illustration
predict(cvob1, newx = x_test, s = "lambda.min")
In normal train test analysis, you fit the scaler to the train data and then use it to transform both the train and test sets. Does glmnet do the same? Or does it use the parameters from the test set (newx in the predict function) to scale the test set?
# Python code - does the R package do the same under the hood?
scaler = StandardScaler()
scaler.fit(train)
scaler.transform(train)
scaler.transform(test)
Thanks for any help!