Neuraxio / Neuraxle

The world's cleanest AutoML library ✨ - Do hyperparameter tuning with the right pipeline abstractions to write clean deep learning production pipelines. Let your pipeline steps have hyperparameter spaces. Design steps in your pipeline like components. Compatible with Scikit-Learn, TensorFlow, and most other libraries, frameworks and MLOps environments.
https://www.neuraxle.org/
Apache License 2.0
608 stars 62 forks source link

SKLearnWrapper : support for BaseEnsemble instances #455

Closed vincent-antaki closed 3 years ago

vincent-antaki commented 3 years ago

What it is

As mentioned in issue #454, an error was raised on save_trial calls when an SKLearnWrapper was to wrap a sklearn BaseEnsemble instance. After investiguating a bit, I realised that support for BaseEnsemble instances was not implemented (there was a stub of unfinished code in metaopt/sklearn.py - I deleted it). This PR includes modification for SKLearnWrapper to support BaseEnsemble instances.

How it works

SKLearn get_params function already includes sub-models parameters if argument deep=True (which it is by default). The only thing that needed to be done was to delete sub-models entry (but not their parameters) in the param dictionary before set/get operations.

Example usage

See issue #454 or new tests in testing/steps/test_sklearn_wrapper.py