Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.calibration import CalibratedClassifierCV
- from sklearn.model_selection import RandomizedSearchCV
- pipe_dtr = Pipeline(steps=[('preprocessor', preprocessor),
- ('clf', DecisionTreeRegressor(random_state=62))])
- params_dtr = {
- 'clf__max_depth' : np.arange(1,100,5),
- 'clf__min_samples_leaf' : [0.01, 0.1, 1]
- }
- gs_dtr = RandomizedSearchCV(estimator=pipe_dtr,
- param_distributions=params_dtr,
- n_iter=25,
- scoring='roc_auc',
- cv=5)
- gs_dtr.fit(X_train, y_train)
- calib_pipe_dtr = Pipeline(steps=[('preprocessor', preprocessor),
- ('calibrator', CalibratedClassifierCV(gs_dtr.best_estimator_, cv='prefit'))])
- calib_pipe_dtr.fit(X_train,y_train)
- RuntimeError: classifier has no decision_function or predict_proba method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement