法士泰的塑形包装纸

fastshapv1的Python项目详细描述


快速成形(V1) >;此项目将SHAP库的一部分引入fastai(V1),并使其兼容。感谢Nestor Demeure对项目的帮助!在

##安装

pip安装fastshap

如何使用

首先,我们将快速训练成人的表格模型

` 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') `

Classification model detected, displaying score for the class <50k. (use class_id to specify another class)

啊![png](docs/images/output_13_2.png)

有关更多示例,请参见[01_Interpret](https://muellerzr.github.io/fastshap//interpret

有关更多非官方的fastai扩展,请参阅[fastai扩展库](https://github.com/nestordemeure/fastai-extensions-repository).

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
javascript节点js require()和Rhino Shell load()之间的区别是什么?   While循环中的java If语句   java GXT如何在XTemplate中显示treeobject?   如何将黑白图像加载到二进制文件中?   java ORMLite不知道如何存储班级航班。扫描仪。modelFX。机场航空公司的AirlineFx。使用另一个类或自定义持久器   java组织。阿帕奇。德比。客户是SqlException JSP和JSTL查询   spring如何将clob数据分配给java变量   java从上的表获取数据(Spring)   javaphp使用Exec执行带有用户定义参数的Jar文件   java jsonschema2pojo:引用相同类型的对象   使用原语从Scala调用Java vararg方法   java ClassNotFoundException:ClientBuilder Jersey 2.25.1 Tomcat 9.0   Android(Java)cr_BindingManager:无法调用determinedVisibility()从未看到pid的连接:   Java使用LocalTime类比较没有日期的时间   Java如何初始化对象的参数?