Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding sklearn min. dependencies for all versions #1022

Merged
merged 3 commits into from
Feb 18, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Dep. string change only for OpenML>v0.11
  • Loading branch information
Neeratyoy committed Feb 18, 2021
commit ffb4a2d72db28c8ab7e47c2d88710bbd0a292022
38 changes: 29 additions & 9 deletions openml/extensions/sklearn/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,37 @@ def _min_dependency_str(cls, sklearn_version: str) -> str:
-------
str
"""
if LooseVersion(sklearn_version) >= "0.24":
openml_major_version = int(LooseVersion(openml.__version__).version[1])
# This explicit check is necessary to support existing entities on the OpenML servers
# that used the fixed dependency string (in the else block)
if openml_major_version > 11:
# OpenML v0.11 onwards supports sklearn>=0.24
# assumption: 0.24 onwards sklearn should contain a _min_dependencies.py file with
# variables declared for extracting minimum dependency for that version
from sklearn import _min_dependencies as _mindep

dependency_list = {
"numpy": "{}".format(_mindep.NUMPY_MIN_VERSION),
"scipy": "{}".format(_mindep.SCIPY_MIN_VERSION),
"joblib": "{}".format(_mindep.JOBLIB_MIN_VERSION),
"threadpoolctl": "{}".format(_mindep.THREADPOOLCTL_MIN_VERSION),
}
if LooseVersion(sklearn_version) >= "0.24":
from sklearn import _min_dependencies as _mindep

dependency_list = {
"numpy": "{}".format(_mindep.NUMPY_MIN_VERSION),
"scipy": "{}".format(_mindep.SCIPY_MIN_VERSION),
"joblib": "{}".format(_mindep.JOBLIB_MIN_VERSION),
"threadpoolctl": "{}".format(_mindep.THREADPOOLCTL_MIN_VERSION),
}
elif LooseVersion(sklearn_version) >= "0.23":
dependency_list = {
"numpy": "1.13.3",
"scipy": "0.19.1",
"joblib": "0.11",
"threadpoolctl": "2.0.0",
}
if LooseVersion(sklearn_version).version[2] == 0:
dependency_list.pop("threadpoolctl")
elif LooseVersion(sklearn_version) >= "0.21":
dependency_list = {"numpy": "1.11.0", "scipy": "0.17.0", "joblib": "0.11"}
elif LooseVersion(sklearn_version) >= "0.19":
dependency_list = {"numpy": "1.8.2", "scipy": "0.13.3"}
else:
dependency_list = {"numpy": "1.6.1", "scipy": "0.9"}
else:
# this is INCORRECT for sklearn versions >= 0.19 and < 0.24
# given that OpenML has existing flows uploaded with such dependency information,
Expand Down