csinva / imodels

Interpretable ML package 🔍 for concise, transparent, and accurate predictive modeling (sklearn-compatible).

Home Page:https://csinva.io/imodels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FIGSRegressor failed to calculate importance_data_tree

jckkvs opened this issue · comments

The following code snippet results in an error.

from imodels import FIGSRegressor
from sklearn.datasets import make_regression
X,y = make_regression(n_features=10)
figs = FIGSRegressor()
figs.fit(X,y)

The error

C:\Users\user\Anaconda3\envs\py310\lib\site-packages\imodels\tree\figs.py:377: RuntimeWarning: invalid value encountered in divide
  importance_data_tree /= tree_samples

This error is caused by the following implementations:

neg_count = value_counts[0.0]

pos_count = value_counts[1.0]

value_counts[0.0] and value_counts[1.0] are code assuming Classifier and do not work with Regressor.