Assume you have a scikit-learn pipeline with two steps: first, a transformer object (eg, PCA) and, second and last, an object with a predict method (eg, a logistic regression). Suppose that your grid contains four different hyperparameter configurations consisting of two different number of principal components (for PCA) and two different regularization parameters (for logistic regressions).
Is the first object (PCA) fitted 4 times (one for each configuration)? Or, on the contrary, it is fitted two times only: for each number of principal components, fits PCA once and twice the logistic regression. This way seems more efficient and equivalent in terms of results.
I thought that it was the second way, but I got confused by a comment on scikit-learn github (https://github.com/scikit-learn/scikit-learn/issues/4813#issuecomment-205185156)