Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. from sklearn.calibration import CalibratedClassifierCV
  2. from sklearn.model_selection import RandomizedSearchCV
  3.  
  4. pipe_dtr = Pipeline(steps=[('preprocessor', preprocessor),
  5. ('clf', DecisionTreeRegressor(random_state=62))])
  6. params_dtr = {
  7. 'clf__max_depth' : np.arange(1,100,5),
  8. 'clf__min_samples_leaf' : [0.01, 0.1, 1]
  9. }
  10. gs_dtr = RandomizedSearchCV(estimator=pipe_dtr,
  11. param_distributions=params_dtr,
  12. n_iter=25,
  13. scoring='roc_auc',
  14. cv=5)
  15.  
  16. gs_dtr.fit(X_train, y_train)
  17.  
  18. calib_pipe_dtr = Pipeline(steps=[('preprocessor', preprocessor),
  19. ('calibrator', CalibratedClassifierCV(gs_dtr.best_estimator_, cv='prefit'))])
  20. calib_pipe_dtr.fit(X_train,y_train)
  21.  
  22. RuntimeError: classifier has no decision_function or predict_proba method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement