Skip to content

Installation of required packages as per https://github.com/slundberg/shap results in import errors #2

@sebastian-lapuschkin

Description

@sebastian-lapuschkin

... and version mismatches.

I installed the listed packages into a conda env called "shap" using conda install -c conda-forge shap.
After cloning https://github.com/suinleelab/treeexplainer-study, installing and running jupyter lab / jupyter notebook, I receive the following error in the first (import) block of notebooks/mortality/NHANES I Analysis.ipynb

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-92f169e55cd2> in <module>
      2 import shap
      3 from sklearn.model_selection import train_test_split
----> 4 from sklearn.preprocessing import StandardScaler, Imputer
      5 import sklearn
      6 import matplotlib.pyplot as pl

ImportError: cannot import name 'Imputer' from 'sklearn.preprocessing' (/home/lapuschkin/miniconda3/envs/shap/lib/python3.8/site-packages/sklearn/preprocessing/__init__.py)

This seems to be caused by the notebook relying on the scikit learn release 0.19.1 (or older; etc.) while the described installation routine has been updated in the mean time, installing scikit learn release 0.24.
Is there any easy and convenient fix to install the required packages to run the experiments in this repo?

Thank you for making your code publicly available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions