Skip to content

Error importing eli5.lime due to deprecated 'itemfreq' from 'scipy.stats' #423

@AndreaMagnanini

Description

@AndreaMagnanini

while trying to import package eli5.lime, interpret gives the following error:

ImportError                               Traceback (most recent call last)
Cell In [10], line 1
----> 1 import eli5.lime

File c:\Users\magna\AppData\Local\Programs\Python\Python310\lib\site-packages\eli5\lime\__init__.py:2
      1 # -*- coding: utf-8 -*-
----> 2 from .lime import (
      3     TextExplainer,
      4     _train_local_classifier
      5 )

File c:\Users\magna\AppData\Local\Programs\Python\Python310\lib\site-packages\eli5\lime\lime.py:18
     16 import eli5
     17 from eli5.sklearn.utils import sklearn_version
---> 18 from eli5.lime.samplers import BaseSampler
     19 from eli5.lime.textutils import DEFAULT_TOKEN_PATTERN, CHAR_TOKEN_PATTERN
     20 from eli5.lime.samplers import MaskingTextSamplers

File c:\Users\magna\AppData\Local\Programs\Python\Python310\lib\site-packages\eli5\lime\samplers.py:9
      6 import six
      8 import numpy as np
----> 9 from scipy.stats import itemfreq
     10 from sklearn.base import BaseEstimator, clone
     11 from sklearn.neighbors import KernelDensity

ImportError: cannot import name 'itemfreq' from 'scipy.stats' (c:\Users\magna\AppData\Local\Programs\Python\Python310\lib\site-packages\scipy\stats\__init__.py)

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