TPOT:在 COLAB 中工作时,拟合后导出的最佳管道(.py 文件)在哪里

TPOT : Where is te the best pipeline (.py file) exported after fitting when working in COLAB

我是运行TPOT文档页面提供的MNIST数据集分类示例。我是通过使用 Google Colab 来做到这一点的,但是我找不到训练后 tpot 检索到的具有最佳管道的代码。

你能帮我弄清楚这个 .py 文件的保存位置吗?

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=50, verbosity=2)
tpot.fit(X_train, y_train)
print(tpot.score(X_test, y_test))
tpot.export('tpot_mnist_pipeline.py')

它将在您的工作目录中。

我在虚拟机上 运行 TPOT 时也遇到了这个问题。为此,我提交了一些代码,允许您也导出到字符串。

使用:

print(tpot.export())

它会将管道代码打印到屏幕上