'NotFittedError make_pipeline
I have following pipeline
num_pipe = make_pipeline(
StandardScaler()
)
cat_pipe = make_pipeline(
OneHotEncoder(handle_unknown="ignore"),
)
preprocessor_tree = make_column_transformer(
(num_pipe, selector(dtype_include="number")),
(cat_pipe, selector(dtype_include="category")),
n_jobs=2,
)
bag_clf = make_pipeline(
preprocessor_tree,
BalancedBaggingClassifier(
base_estimator=HistGradientBoostingClassifier(random_state=42),
n_estimators=10,
random_state=42,
n_jobs=2,
),
)
cv_result = cross_validate(bag_clf, X_train, y_train, scoring=scoring)
after cross validation i try
y_pred = bag_clf.predict(X_test)
and got This ColumnTransformer instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.
How evaluate classifiers on unseen data ?
Solution 1:[1]
You still need to .fit your pipeline after cross validation, as the error is indicating.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rikyeah |
