本文介绍了Python 3:没有名为"sklearn.model_selection"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Python的Keras深度学习库学习神经网络.我正在使用Python 3并引用此链接:教程链接

I am trying to learn Neural Networks via the Keras Deep Learning Library in Python. I am using Python 3 and referencing this link: Tutorial Link

我尝试运行以下代码,但出现以下错误:

I try to run the code below but get the following error:

ImportError:没有名为"sklearn.model_selection"的模块

ImportError: No module named 'sklearn.model_selection'

import numpy
import pandas

from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline

任何帮助将不胜感激!

推荐答案

我认为您安装了错误版本的sklearn.

I think you install wrong version of sklearn.

请尝试以下操作:导入sklearn打印(sklearn .__ version__)0.17.1

如果您的版本低于0.18,请使用 pip install -U scikit-learn pip3 install -U scikit-learn

If your version is below 0.18, please update with pip install -U scikit-learn or pip3 install -U scikit-learn

如果出现 import Error ,请使用 pip install scikit-learn pip3 install scikit-learn

这篇关于Python 3:没有名为"sklearn.model_selection"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 15:46