This works the way you would want out of the box.
pipeline takes standard scaler class
No, pipelines get initialized with estimator instances, not the classes. (This is why you need the parentheses in the steps, e.g. StandardScaler()
.)
That is, the following works:
from sklearn.datasets import load_breast_cancer
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import Pipeline
X, y = load_breast_cancer(return_X_y=True)
scaler = StandardScaler()
lr = LogisticRegression()
X_sc = scaler.fit_transform(X)
lr.fit(X_sc, y)
pipe = Pipeline(steps=[('scale', scaler),
('lr', lr)])
# Predicting would fail if the pipeline had unfitted estimators:
pipe.predict_proba(X)