安装#
克隆代码
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
也可以运行 Native 代码 / Python 的特定单元测试
构建并运行 interpret/shared/libebm/tests
cd interpret/python/interpret-core
python -m pytest
要运行所有测试,请添加参数 --runslow
python -m pytest –runslow
安装 Text Explorer UI 扩展
打开命令面板 (例如按 F1)
(可选) 如果正在使用 conda 环境,请选择 Python: Select Interpreter 并选择正确的环境
选择 Python: Configure Tests 并选择 pytest
选择根文件夹为
interpret/python
选择测试框架后,您应该能够打开 Test Explorer 扩展并运行所有 Python 单元测试
要查看测试的输出,请前往 输出窗口 –> Python 测试日志
有些测试依赖于 C++ 代码,因此应该安装它