法士泰的塑形包装纸

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第三方库


热门话题
java重写父类中的特定行   java Apache Commons CLI订购帮助选项?   java如何将数据添加到网格视图   java如何在Apache Camel批处理后移动文件?   java如何为日期范围的between子句编写hql查询?   雅加达ee开始Java编程,我应该从哪里开始?   排序Java8+流:检查我的objectinstances的两个字段的列表顺序是否正确   java如何将json转换为Map<String,Object>确保整数为整数   java不能在Spring数据JPA批处理过程中创建TransactionException   java损坏的PDF文件从FTP下载到使用Apache Common Net的设备   java无法使用Spring批处理和Wso2为XML架构命名空间找到Spring NamespaceHandler   java Android ImageView未显示在SherlockFragment中   Maven在构建时出错=无法识别Java路径   java如何使用批处理文件调用关闭处理程序?   java admob广告横幅重叠我的游戏屏幕安卓