Skip to content

AutoSklearn2Classifier issues being pickle-ed #905

@23pointsNorth

Description

@23pointsNorth

Describe the bug

I've been testing the AutoSklearnClassifier and AutoSklearn2Classifier classifiers.

Using the v1, I get expected results in training the model. However, on saving, it crashes with the following details:

/home/bot/.local/lib/python3.6/site-packages/sklearn/linear_model/_stochastic_gradient.py:557: ConvergenceWarning: Maximum number of iteration reached before convergence. Consider increasing max_iter to improve the fit.
ConvergenceWarning)
/home/bot/.local/lib/python3.6/site-packages/sklearn/base.py:197: FutureWarning: From version 0.24, get_params will raise an AttributeError if a parameter cannot be retrieved as an instance attribute. Previously it would return None.
FutureWarning)
Traceback (most recent call last):
File "/usr/lib/python3.6/pickle.py", line 918, in save_global
obj2, parent = _getattribute(module, name)
File "/usr/lib/python3.6/pickle.py", line 266, in _getattribute
.format(name, obj))
AttributeError: Can't get local attribute 'get_smac_object_callback..get_smac_object' on <function get_smac_object_callback at 0x7ff884638378>
During handling of the above exception, another exception occurred:
joblib.dump(model, osp.join(base_path, model_type + "_model.pkl"))
_pickle.PicklingError: Can't pickle <function get_smac_object_callback..get_smac_object at 0x7ff8427e7f28>: it's not found as autosklearn.experimental.askl2.get_smac_object_callback..get_smac_object

From what I've gathered, the model cannot be pickled.

To Reproduce

// Make a classifier using:
from autosklearn.classification import AutoSklearnClassifier
import joblib
model = AutoSklearnClassifier()
model.fit(X,y)
joblib.dump(model, "model.pkl")

Expected behavior

Both v1 and v2 classifiers to be able to fit, save and re-load.

Actual behavior, stacktrace or logfile

See above

Environment and installation:

Please give details about your installation:
Versions in docker container:
sklearn: 0.22.2.post1
auto-sklearn: 0.8.0
python: 3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions