Skip to content

Commit

Permalink
Update sklearn_extra/robust/robust_weighted_estimator.py
Browse files Browse the repository at this point in the history
Fix CI Python 3.8

Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
  • Loading branch information
TimotheeMathieu and rth authored Jun 18, 2020
1 parent 27d674e commit c4945d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sklearn_extra/robust/robust_weighted_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,15 @@ def _get_loss_function(self, loss):
raise ValueError("The loss %s is not supported. " % self.loss)

loss_class, args = eff_loss[0], eff_loss[1:]
return np.vectorize(loss_class(*args).dloss)
# at the top of the file
from distutils.version import LooseVersion

if LooseVersion(sklearn.__version__) >= LooseVersion("0.24.0"):
dloss_attr = 'py_dloss'
else:
dloss_attr = 'dloss'

return np.vectorize(geattr(loss_class(*args), dloss_attr))
else:
return loss

Expand Down

0 comments on commit c4945d1

Please # to comment.