【Bug记录】ModuleNotFoundError: No module named ‘sklearn.grid_search‘

简介: 【Bug记录】ModuleNotFoundError: No module named ‘sklearn.grid_search‘

@[toc]


一、报错代码

from sklearn.grid_search import GridSearchCV

二、报错信息

ModuleNotFoundError                       Traceback (most recent call last)
Input In [28], in <cell line: 8>()
      6 from IPython.display import Image
      7 from sklearn.ensemble import RandomForestRegressor
----> 8 from sklearn.grid_search import GridSearchCV
      9 # from sklearn.model_selection import GridSearchCV
     10 from sklearn.model_selection import train_test_split

ModuleNotFoundError: No module named 'sklearn.grid_search'

三、报错原因

sklearn.grid_search模块在0.18版本中被弃用,它所支持的类转移到model_selection模块中。还要注意,新的CV迭代器的接口与这个模块的接口不同。sklearn.grid_search将在0.20中被删除。

四、解决方案

将报错代码替换为下面的代码即可解决问题:

from sklearn.model_selection import GridSearchCV
目录
相关文章
|
5月前
|
机器学习/深度学习 Python
【Python】已解决:ModuleNotFoundError: No module named ‘paddle’
【Python】已解决:ModuleNotFoundError: No module named ‘paddle’
873 1
|
5月前
|
计算机视觉 Python
【Python】已解决:ModuleNotFoundError: No module named ‘cv2’
【Python】已解决:ModuleNotFoundError: No module named ‘cv2’
988 0
|
7月前
|
Linux iOS开发 MacOS
[已解决]ModuleNotFoundError: No module named ‘tqdm‘
[已解决]ModuleNotFoundError: No module named ‘tqdm‘
|
异构计算
ModuleNotFoundError: No module named ‘mmcv._ext‘
最近想将mmsegmentation打包成exe进行使用,但是遇到了一个问题,在打包的过程中不会显示报错信息,但是在执行exe程序之后,exe会出现ModuleNotFoundError: No module named 'mmcv._ext'的报错,导致软件崩溃。
1047 0
pip安装skbuild报错:ModuleNotFoundError: No module named ‘skbuild’解决方法
pip安装skbuild报错:ModuleNotFoundError: No module named ‘skbuild’解决方法,换源
766 0
|
Python
1. 成功解决 Bug:ModuleNotFoundError: No module named 'pip'
Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _ru
210 0
|
TensorFlow 算法框架/工具 计算机视觉
No module named ‘cv2‘ 解决办法 (No module named ‘numpy‘ 等所有报错均可解决)
No module named ‘cv2‘ 解决办法 (No module named ‘numpy‘ 等所有报错均可解决)
|
机器学习/深度学习 算法 安全
解决ModuleNotFoundError: No module named ‘dlib‘问题-提供3.7x与3.9两个版本
解决ModuleNotFoundError: No module named ‘dlib‘问题-提供3.7x与3.9两个版本
1213 0
解决ModuleNotFoundError: No module named ‘dlib‘问题-提供3.7x与3.9两个版本
【Bug记录】ModuleNotFoundError: No module named ‘sklearn.datasets.california_housing‘
【Bug记录】ModuleNotFoundError: No module named ‘sklearn.datasets.california_housing‘
325 0