[MNT] isolate `scikit-learn`
I think we should make scikit-learn an optional dependency of gfo.
Otherwise, currently, hyperactive depends on gfo, and gfo on scikit-learn, making it a required dependency - even though it is used only in a small number of places.
This PR "isolates" scikit-learn in the sense that:
- imports do not happen on module level where possible
-
scikit-learnis installed as a test dependency instead of as a core dependency
Also does some other minor things:
- remove unused imports
This would lead to a worse "out of the box" experience for the user, since using these optimizers will raise an error if sklearn is not already installed, right? Sklearn is not an optional dependency, but is (at the moment) required for the use of the supported optimization algorithms of this package. But to minimize dependencies I started to natively implement the required estimators in this module: https://github.com/SimonBlanke/Gradient-Free-Optimizers/tree/master/src/gradient_free_optimizers/_estimators
This way sklearn can be a true optional dependency.
This would lead to a worse "out of the box" experience for the user, since using these optimizers will raise an error if sklearn is not already installed, right?
Hm, yes, if we move scikit-learn to the optional dependency set, you are right.
However, if we do not change pyproject.toml, I believe nothing would change from the user perspective? Only the imports are more restricted, and no scikit-learn imports happen on module level anymore.
However, if we do not change pyproject.toml, I believe nothing would change from the user perspective? Only the imports are more restricted, and no scikit-learn imports happen on module level anymore.
yes, this will work fine.