interpretml/gam-changer

Version 0.1.4 breaks gam-changer-adult.ipynb notebook

msplants opened this issue · 2 comments

Hello,

There is a check for nans in 0.1.4 (line 268 of gamchanger.py) that breaks on string values. If I use version 0.1.3, the notebook still works. I think columns of string type should be encoded before this check.

Thanks,
Jessica

[/usr/local/lib/python3.7/dist-packages/gamchanger/gamchanger.py](https://localhost:8080/#) in get_sample_data(ebm, x_test, y_test, resort_categorical)
    266 
    267     # Drop all rows with any NA values
--> 268     if np.isnan(x_test_copy).any():
    269         na_row_indexes = np.isnan(x_test_copy).any(axis=1)
    270         x_test_copy = x_test_copy[~na_row_indexes]

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Hello Jessica! Thanks for reporting this bug! In 0.1.4, I added code to handle missing value (#4). I should have used pd.isnull() instead of np.isnan(), so that it could work on string values.

45d0d89 and 0.1.5 should fix it. If you have time, can you try version 0.1.5? Thanks!

Thanks so much @xiaohk! The notebook is working again :)