0
$\begingroup$

I'm performing a nested cross validation where the inner loop is a GridSearchCV, which takes as estimator a Pipeline containing, among other things, a step for features standardization with StandardScaler.

I know that inside GridSearchCV StandardScaler is correcly fitted over the training set and than applied to both the training and the "validation" (the test set of the inner loop of the nested cv) sets.

What I'm not able to do a similar thing in the outher cv (for each fold of that outer loop, fit a scaler on the training set and apply it to both the training and the test sets).

$\endgroup$
0
$\begingroup$

I thought about the same topic, although I do not have a correct or validated answer I'll just share my thoughts.

I started with the outer CV, so for one pair (train_set, test_set) I standardize the train_set and apply it to the test set as well (as you said you would do for the inner circle). Then for the inner CV I just consider my standardized train_set as my new dataset in the inner circle, hence for every pair (new_train_set, new_test_set) I do the same as before.

If your question was more focused on the explicit functions that are used (as StandardScaler, ..) I cannot say anything about that since I don't use python.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.