【发布时间】:2018-06-29 04:02:25
【问题描述】:
按照此处给出的所有步骤,我已经安装了 tpot 机器学习库:http://epistasislab.github.io/tpot/installing/
下面是我的简单源码[https://github.com/EpistasisLab/tpot]:
from tpot import TPOTClassifier
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
digits = 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 TPOTClassifier
ModuleNotFoundError: No module named 'tpot'
我现在不确定是什么原因造成的。我检查了该模块的 GitHub 问题,并遵循了那里给出的所有解决方案。我正在使用通过 Homebrew 安装的 Max OS high Sierra 和 Python
【问题讨论】:
-
我使用 pip install tpot 安装了相同的。它适用于 Python2.7.12,但同样的过程不能让它适用于 python3.6.0
-
需要检查的几件事: 1) 在与“test.py”相同的目录中是否有一个名为“tpot.py”的文件? 2)您确定 TPOT 安装在与您运行此脚本相同的 Python 安装上吗?尝试进入Python交互终端(在命令行输入“python”)并尝试在那里导入tpot。
-
不,我没有test.py和tpot.py在同一个目录。我也试过命令行,还是不能导入tpot。
标签: python-3.x machine-learning tpot