EpistasisLab / EpistasisLab/tpot

Error thrown when pickling TPOTClassifier object

Open
#608 1 comment 0 reactions 0 assignees View on GitHub
need contributor question
Dominant language
Jupyter Notebook
Stars
10.1k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

When I attempt to pickle a TPOTClassifier object I get an error.

To reproduce, use the iris TPOT demo and add lines at the end to pickle the TPOTClassifier object.

```
from tpot import TPOTClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import numpy as np

iris = load_iris()
X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64),
iris.target.astype(np.float64), 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_iris_pipeline.py')

import pickle
with open('iris_tpot.pkl'.format(filename_key),'wb') as f:
pickle.dump(tpot, f)
```

When I run above code I get the following error output:
```
Traceback (most recent call last):

File "", line 2, in
pickle.dump(tpot, f)

PicklingError: Can't pickle : attribute lookup GradientBoostingClassifier__learning_rate on tpot.operator_utils failed
```
and the .pkl file has 0 bytes in it.

I would expect to be able to pickle a TPOTClassifier object and reload it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.