您现在的位置是:首页 > 电脑 > 

AttributeError:'GridSearchCV'对象没有属性'cv

2025-07-27 15:26:25
AttributeError:'GridSearchCV'对象没有属性'cv_results_'(AttributeError: 'GridSearchCV' object has no attribute 'cv_results_') 我尝试应用此代码: pipe = make_pipeline(TfidfVectorizer(min_df=5), Log
AttributeError:'GridSearchCV'对象没有属性'cv_results_'(AttributeError: 'GridSearchCV' object has no attribute 'cv_results_')

我尝试应用此代码:

pipe = make_pipeline(TfidfVectorizer(min_df=5), LogisticRegression()) param_grid = {'logisticregression__C': [ 0.001, 0.01, 0.1, 1, 10, 100], "tfidfvectorizer__ngram_range": [(1, 1),(1, 2),(1, )]} grid = GridSearchCV(pipe, param_grid, cv=5) grid.fit(text_train, Y_train) scores = _results_['mean_test_score'].reshape(-1, ).T # visualize heat map heatmap = heatmap( scores, xlabel="C", ylabel="ngram_range", cmap="viridis", fmt="%.f", xticklabels=param_grid['logisticregression__C'], yticklabels=param_grid['tfidfvectorizer__ngram_range']) (heatmap)

但我有这个错误:

AttributeError: 'GridSearchCV' object has no attribute 'cv_results_'

提前致谢

I try to apply this code :

pipe = make_pipeline(TfidfVectorizer(min_df=5), LogisticRegression()) param_grid = {'logisticregression__C': [ 0.001, 0.01, 0.1, 1, 10, 100], "tfidfvectorizer__ngram_range": [(1, 1),(1, 2),(1, )]} grid = GridSearchCV(pipe, param_grid, cv=5) grid.fit(text_train, Y_train) scores = _results_['mean_test_score'].reshape(-1, ).T # visualize heat map heatmap = heatmap( scores, xlabel="C", ylabel="ngram_range", cmap="viridis", fmt="%.f", xticklabels=param_grid['logisticregression__C'], yticklabels=param_grid['tfidfvectorizer__ngram_range']) (heatmap)

But I have this error :

AttributeError: 'GridSearchCV' object has no attribute 'cv_results_'

最满意答案

更新你的scikit-learn, cv_results_已在0.18.1中引入,之前它被称为grid_scores_并且结构略有不同http:///0.17/modules/generated/sklearn.grid_search.GridSearchCV.html#sklearn .grid_search.GridSearchCV

Solved ! Uninstall and install conda scikit learn in 0.18.1 How to upgrade scikit-learn package in anaconda.

When I import GridSearch :

from _selection import GridSearchCV

#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/diannao/79522.html

相关标签:无
上传时间: 2023-04-28 04:54:58
留言与评论(共有 17 条评论)
本站网友 焦糖色
21分钟前 发表
10
本站网友 99宿舍加速器
11分钟前 发表
from _selection import GridSearchCV
本站网友 诺基亚铃音
4分钟前 发表
///0.17/modules/generated/sklearn.grid_search.GridSearchCV.html#sklearn .grid_search.GridSearchCV Solved ! Uninstall and install conda scikit learn in 0.18.1 How to upgrade scikit-learn package in anaconda. When I import GridSearch
本站网友 天嘉宜化工有限公司
25分钟前 发表
).T # visualize heat map heatmap = heatmap( scores
本站网友 vsd格式
18分钟前 发表
xlabel="C"
本站网友 草六
4分钟前 发表
(1
本站网友 熊猫债券
18分钟前 发表
(1
本站网友 nexus怎么读
20分钟前 发表
fmt="%.f"
本站网友 洫通激光治疗仪
12分钟前 发表
LogisticRegression()) param_grid = {'logisticregression__C'
本站网友 amr文件
20分钟前 发表
'GridSearchCV' object has no attribute 'cv_results_' 最满意答案 更新你的scikit-learn
本站网友 快手枪手快枪手
27分钟前 发表
ylabel="ngram_range"
本站网友 产业结构优化升级
17分钟前 发表
"tfidfvectorizer__ngram_range"
本站网友 俄罗斯普京
26分钟前 发表
0.01
本站网友 梦龙乐队
0秒前 发表
[ 0.001
本站网友 姓名与命运
23分钟前 发表
xlabel="C"
本站网友 深圳冷水机
20分钟前 发表
[ 0.001