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

Importing "HSTreeRegressor" gets ImportError #207

Open
emacheng opened this issue Jun 17, 2024 · 1 comment
Open

Importing "HSTreeRegressor" gets ImportError #207

emacheng opened this issue Jun 17, 2024 · 1 comment

Comments

@emacheng
Copy link

emacheng commented Jun 17, 2024

I'm using matplotlib==3.8.4 scikit-learn==1.4.0 numpy==1.26.0.
When I'm trying to import HSTreeRegressor I get a ImportError:

[/usr/local/lib/python3.10/dist-packages/imodels/util/score.py](https://localhost:8080/#) in <module>
      4 import pandas as pd
      5 import numpy as np
----> 6 from sklearn.utils._mask import indices_to_mask
      7 from sklearn.linear_model import Lasso, LogisticRegression
      8 from sklearn.linear_model._coordinate_descent import _alpha_grid

ImportError: cannot import name 'indices_to_mask' from 'sklearn.utils._mask' (/usr/local/lib/python3.10/dist-packages/sklearn/utils/_mask.py)

But if I delete the line from sklearn.utils._mask import indices_to_mask from the score.py I solve the problem. I am not an expert in machine learning and coding, so I not sure what indices_to_mask does in the code.

@csinva
Copy link
Owner

csinva commented Jun 18, 2024

Sorry about this, sklearn moved indices_to_mask in a recent version so the best current solution for this is just upgrading sklearn with pip install --upgrade scikit-learn. We will find a fix for this function in the meantime...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants