automl / HpBandSter

a distributed Hyperband implementation on Steroids
BSD 3-Clause "New" or "Revised" License
611 stars 109 forks source link

Support scipy 1.3+ #106

Open hotohoto opened 3 years ago

hotohoto commented 3 years ago

I got this traceback using scipy 1.4.2.

Traceback (most recent call last):
...
    ray_search_algorithm=TuneBOHB(metric="loss", mode="min", seed=self.seed),
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/ray/tune/suggest/bohb.py", line 116, in __init__
    from hpbandster.optimizers.config_generators.bohb import BOHB
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/hpbandster/optimizers/__init__.py", line 3, in <module>
    from hpbandster.optimizers.bohb import BOHB
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/hpbandster/optimizers/bohb.py", line 14, in <module>
    from hpbandster.optimizers.config_generators.bohb import BOHB as CG_BOHB
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/hpbandster/optimizers/config_generators/bohb.py", line 12, in <module>
    import statsmodels.api as sm
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/statsmodels/api.py", line 16, in <module>
    from .discrete.discrete_model import (Poisson, Logit, Probit,
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py", line 45, in <module>
    from statsmodels.distributions import genpoisson_p
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/statsmodels/distributions/__init__.py", line 2, in <module>
    from .edgeworth import ExpandedNormal
  File "/home/hotohoto/.pyenv/versions/3.6.10/envs/mlcore/lib/python3.6/site-packages/statsmodels/distributions/edgeworth.py", line 7, in <module>
    from scipy.misc import factorial
ImportError: cannot import name 'factorial'

Fortunately, there is a workaround.

import scipy

# patch scipy
scipy.misc.factorial = scipy.special.factorial
scipy.misc.logsumexp = scipy.special.logsumexp
scipy.misc.comb = scipy.special.comb
mostafa-mahmoud commented 3 years ago

@hotohoto Try updating statsmodels package.