在使用TPOT在Google Colab中拟合后,最佳管道(.py文件)默认是保存在当前工作目录下的tpot_exported_pipeline.py
文件中。您可以使用以下代码示例来导出最佳管道文件到指定的位置:
from tpot import TPOTClassifier
# 拟合TPOT模型
tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2)
tpot.fit(X_train, y_train)
# 导出最佳管道
exported_pipeline = tpot.fitted_pipeline_
exported_pipeline.export('path/to/exported_pipeline.py')
请将path/to/exported_pipeline.py
替换为您想要保存最佳管道文件的路径。