Scikit - Combining scale and grid search

一个人想着一个人 提交于 2019-12-03 16:21:55
  1. GridSearchCV knows nothing about Pipeline object, it assumes that provided estimator is atomic in the sense that it cannot choose only some particular stage (StandartScaler for example) and fit different stages on different data. All GridSearchCV does - calls fit(X, y) method on provided estimator, where X,y - some splits of data. Thus it fits all stages on same splits.
  2. Try this:

    best_pipeline = my_grid_search.best_estimator_ best_scaler = best_pipeline["standartscaler"]

  3. In case when you wrap your transformers/estimators into Pipeline - you have to add a prefix to a name of each parameter, e.g: tuned_parameters = [{'svc__C': [1, 10, 100, 1000]}], look at these examples for more details Concatenating multiple feature extraction methods, Pipelining: chaining a PCA and a logistic regression

Anyway read this, it may help you GridSearchCV

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!