fastai的shap包装器
项目描述
# FastSHAP (V1) > 此项目将部分SHAP库引入fastai (V1)并使其兼容。感谢Nestor Demeure在此项目中提供的帮助!
## 安装
pip install fastshap
## 使用方法
首先,我们将快速训练一个ADULTS表格模型
` from fastai2.tabular.all import * `
` path = untar_data(URLs.ADULT_SAMPLE) df = pd.read_csv(path/'adult.csv') `
` dep_var = 'salary' cat_names = ['workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race'] cont_names = ['age', 'fnlwgt', 'education-num'] procs = [Categorify, FillMissing, Normalize] `
` splits = IndexSplitter(list(range(800,1000)))(range_of(df)) to = TabularPandas(df, procs, cat_names, cont_names, y_names="salary", splits=splits) dls = to.dataloaders() `
` learn = tabular_learner(dls, layers=[200,100], metrics=accuracy) learn.fit(1, 1e-2) `
现在,让我们看看一些示例用法!
` from fastshap.interp import * `
` exp = ShapInterpretation(learn, df.iloc[:100]) `
` exp.dependence_plot('age') `
分类模型检测到,显示 <50k 类的分数。(使用 class_id 指定其他类别)

更多示例请参阅 [01_Interpret](https://muellerzr.github.io/fastshap//interpret)
更多非官方 fastai 扩展,请参阅 [Fastai 扩展存储库](https://github.com/nestordemeure/fastai-extensions-repository)。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分布
构建分布
fastshapv1-0.0.10.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 77d477475da3e0310021664d683a06f823398f12658732650cc35d554b750ccc |
|
MD5 | c97c8059f6e935d6a9c1c9fbfd65397e |
|
BLAKE2b-256 | 5bd673fc1414b24b7a3434358183121cda5b307d19aa96e80016e1629fc2b782 |
fastshapv1-0.0.10-py2-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2614d5834319a55605ec1bfc3231f5109abf4b30aef26147005e7867d49fdc55 |
|
MD5 | 4cdef439d6e81daa41b4958194a57cb6 |
|
BLAKE2b-256 | ca137c31a09c9094c69df8b689b1335c37d8468aab69574a1516fb1cddc5b68e |