安装#

克隆代码

git clone https://github.com/interpretml/interpret.git

(可选)创建一个conda环境并激活它

conda create --name ENV_NAME python=3.10

conda activate ENV_NAME

安装 `interpret` 及其所有依赖项

cd interpret/scripts

make install

cd ../python/interpret-core

pip install -e .[debug,notebook,plotly,lime,sensitivity,shap,linear,skoperules,treeinterpreter,aplr,dash,testing]

运行单元测试

cd interpret/scripts

make test

也可以运行针对本地代码 / Python 的特定单元测试:

构建并运行 interpret/shared/libebm/tests

cd interpret/python/interpret-core

python -m pytest


要运行所有测试,请添加参数 --runslow

python -m pytest –runslow

  1. 安装Text Explorer UI扩展

  2. 打开命令面板(例如按F1)

  3. (可选)如果正在使用conda环境,请选择Python: 选择解释器并选择正确的环境

  4. 选择 Python: 配置测试 并选择 pytest

  5. 选择根文件夹为 interpret/python

  6. 一旦选择了测试框架,您应该能够打开测试资源管理器扩展并运行所有Python单元测试

    • 要查看测试的输出,请转到输出窗口 –> Python测试日志

    • 一些测试依赖于C++代码,因此应该安装它