sklearn估计器管道的参数无效 [英] Invalid parameter for sklearn estimator pipeline

查看:529
本文介绍了sklearn估计器管道的参数无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python 2.7和sklearn 0.16实现O'Reilly的书" Python机器学习入门"中的示例.

I am implementing an example from the O'Reilly book "Introduction to Machine Learning with Python", using Python 2.7 and sklearn 0.16.

我正在使用的代码:

pipe = make_pipeline(TfidfVectorizer(), LogisticRegression())
param_grid = {"logisticregression_C": [0.001, 0.01, 0.1, 1, 10, 100], "tfidfvectorizer_ngram_range": [(1,1), (1,2), (1,3)]}
grid = GridSearchCV(pipe, param_grid, cv=5)
grid.fit(X_train, y_train)
print("Best cross-validation score: {:.2f}".format(grid.best_score_))

返回的错误归结为:

ValueError: Invalid parameter logisticregression_C for estimator Pipeline

这是与使用v.0.16版中的Make_pipeline有关的错误吗?是什么导致此错误?

Is this an error related to using Make_pipeline from v.0.16? What is causing this error?

推荐答案

请参见 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆