无法导入tpot

我按照这里给出的所有步骤安装了tpot机器学习库: http://epistasislab.github.io/tpot/installing/

当我查看pip3 list时,我能看到tpot已经安装。 enter image description here

以下是我简单的源代码 [https://github.com/EpistasisLab/tpot]:

from tpot import TPOTClassifierfrom sklearn.datasets import load_digitsfrom sklearn.model_selection import train_test_splitdigits = load_digits()X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target,                                                    train_size=0.75, test_size=0.25)tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2)tpot.fit(X_train, y_train)print(tpot.score(X_test, y_test))tpot.export('tpot_mnist_pipeline.py')

我得到了以下错误:

Traceback (most recent call last):  File "test.py", line 1, in <module>    from tpot import TPOTClassifierModuleNotFoundError: No module named 'tpot'

我现在不确定是什么原因导致的。我查看了该模块的GitHub问题,并按照那里给出的所有解决方案进行了操作。我使用的是Max OS High Sierra操作系统,并通过Homebrew安装了Python


回答:

我遇到了同样的问题,看起来是因为脚本被命名为tpot.py。将其改为其他名称应该可以解决问题 🙂

Related Posts

Keras Dense层输入未被展平

这是我的测试代码: from keras import…

无法将分类变量输入随机森林

我有10个分类变量和3个数值变量。我在分割后直接将它们…

如何在Keras中对每个输出应用Sigmoid函数?

这是我代码的一部分。 model = Sequenti…

如何选择类概率的最佳阈值?

我的神经网络输出是一个用于多标签分类的预测类概率表: …

在Keras中使用深度学习得到不同的结果

我按照一个教程使用Keras中的深度神经网络进行文本分…

‘MatMul’操作的输入’b’类型为float32,与参数’a’的类型float64不匹配

我写了一个简单的TensorFlow代码,但不断遇到T…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注