ModuleNotFoundError: No module named ‘sklearn.grid_search‘问题的解决

问题描述:

from sklearn.grid_search import GridSearchCV时报错:

from sklearn.ensemble import RandomForestClassifier
from sklearn.grid_search import GridSearchCV

ModuleNotFoundError Traceback (most recent call
last) ~\AppData\Local\Temp/ipykernel_13796/2171051172.py in
1 from sklearn.ensemble import RandomForestClassifier
----> 2 from sklearn.grid_search import GridSearchCV

ModuleNotFoundError: No module named ‘sklearn.grid_search’


原因分析:

sklearn版本更新


解决方案:

将from sklearn.grid_search import GridSearchCV换成from sklearn.model_selection import GridSearchCV

你可能感兴趣的:(python,bug,小计,sklearn,python,机器学习)