Skip to content

Commit

Permalink
Merge pull request #4768 from PrimozGodec/fix-scikit
Browse files Browse the repository at this point in the history
[FIX] Fix compatibility with scikit-learn 0.23
  • Loading branch information
markotoplak authored May 22, 2020
2 parents d0afe52 + 4dedf99 commit c9cc090
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions Orange/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,14 @@ def params(self, value):
def _get_sklparams(self, values):
skllearner = self.__wraps__
if skllearner is not None:
spec = inspect.getargs(skllearner.__init__.__code__)
spec = list(
inspect.signature(skllearner.__init__).parameters.keys()
)
# first argument is 'self'
assert spec.args[0] == "self"
params = {name: values[name] for name in spec.args[1:]
if name in values}
assert spec[0] == "self"
params = {
name: values[name] for name in spec[1:] if name in values
}
else:
raise TypeError("Wrapper does not define '__wraps__'")
return params
Expand Down
11 changes: 7 additions & 4 deletions Orange/projection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,14 @@ def params(self, value):
def _get_sklparams(self, values):
sklprojection = self.__wraps__
if sklprojection is not None:
spec = inspect.getargs(sklprojection.__init__.__code__)
spec = list(
inspect.signature(sklprojection.__init__).parameters.keys()
)
# first argument is 'self'
assert spec.args[0] == "self"
params = {name: values[name] for name in spec.args[1:]
if name in values}
assert spec[0] == "self"
params = {
name: values[name] for name in spec[1:] if name in values
}
else:
raise TypeError("Wrapper does not define '__wraps__'")
return params
Expand Down
2 changes: 1 addition & 1 deletion requirements-core.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pip>=9.0
numpy>=1.16.0
scipy>=0.16.1
scikit-learn>=0.22.0,<0.23 # temp fix: https://github.com/biolab/orange3/pull/4768
scikit-learn>=0.22.0,!=0.23.0 # 0.23.0 have error with slow k-means, it will be fixed in 0.23.1
bottleneck>=1.0.0
# Reading Excel files
xlrd>=0.9.2
Expand Down

0 comments on commit c9cc090

Please sign in to comment.