René's URL Explorer Experiment


Title: 树模型决策的可解释性与微调(Python) · Issue #59 · aialgorithm/Blog · GitHub

Open Graph Title: 树模型决策的可解释性与微调(Python) · Issue #59 · aialgorithm/Blog

X Title: 树模型决策的可解释性与微调(Python) · Issue #59 · aialgorithm/Blog

Description: 本文示例沿用之前文章的数据:一文梳理金融风控建模全流程(Python)) 一、树模型的解释性 集成学习树模型因为其强大的非线性能力及解释性,在表格类数据挖掘等任务中应用频繁且表现优异。 模型解释性对于某些领域(如金融风控)是极为看重的,对于树模型的解释性,我们常常可以通过输出树模型的结构或使用shap等解释性框架的方法 graphviz 输出树结构 # 需要先安装https://graphviz.org/download/ import os os.environ["P...

Open Graph Description: 本文示例沿用之前文章的数据:一文梳理金融风控建模全流程(Python)) 一、树模型的解释性 集成学习树模型因为其强大的非线性能力及解释性,在表格类数据挖掘等任务中应用频繁且表现优异。 模型解释性对于某些领域(如金融风控)是极为看重的,对于树模型的解释性,我们常常可以通过输出树模型的结构或使用shap等解释性框架的方法 graphviz 输出树结构 # 需要先安装https://graphv...

X Description: 本文示例沿用之前文章的数据:一文梳理金融风控建模全流程(Python)) 一、树模型的解释性 集成学习树模型因为其强大的非线性能力及解释性,在表格类数据挖掘等任务中应用频繁且表现优异。 模型解释性对于某些领域(如金融风控)是极为看重的,对于树模型的解释性,我们常常可以通过输出树模型的结构或使用shap等解释性框架的方法 graphviz 输出树结构 # 需要先安装https://graphv...

Opengraph URL: https://github.com/aialgorithm/Blog/issues/59

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"树模型决策的可解释性与微调(Python)","articleBody":"\u003e本文示例沿用之前文章的数据:[一文梳理金融风控建模全流程(Python)](https://mp.weixin.qq.com/s?__biz=MzI4MDE1NjExMQ==\u0026mid=2247489574\u0026idx=1\u0026sn=98ca40dd2775428963b50a05e3a1f06c\u0026chksm=ebbd9a86dcca1390c85fe18b330db1f8c0458a783a8d327c65a74fbcb38f2b72390dc64c4fe2\u0026scene=178\u0026cur_album_id=1986073923821551618#rd))\r\n## 一、树模型的解释性\r\n\r\n集成学习树模型因为其强大的非线性能力及解释性,在表格类数据挖掘等任务中应用频繁且表现优异。\r\n\r\n模型解释性对于某些领域(如金融风控)是极为看重的,对于树模型的解释性,我们常常可以通过输出树模型的结构或使用shap等解释性框架的方法\r\n\r\n###  graphviz 输出树结构\r\n```\r\n# 需要先安装https://graphviz.org/download/\r\nimport os\r\nos.environ[\"PATH\"] += os.pathsep + 'D:/Program Files/Graphviz/bin/'   # 安装路径\r\n\r\nfor k in range(n_estimators):  #遍历n_estimators棵树的结构\r\n    ax = lightgbm.plot_tree(lgb, tree_index=k, figsize=(30,20), show_info=['split_gain','internal_value','internal_count','internal_weight','leaf_count','leaf_weight','data_percentage'])\r\nplt.show()\r\n```\r\n![](https://upload-images.jianshu.io/upload_images/11682271-9dab58606ecf788c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n输出树的决策路径是很直接的方法,但对于大规模(树的数目\u003e3基本就比较绕了)的集成树模型来说,决策就太过于复杂了,最终决策要每棵树累加起来(相关树的可解释工作,可参考如下论文:https://www.cs.sjtu.edu.cn/~kzhu/papers/kzhu-infocode.pdf),很难理解。。接下介绍下常用的几种框架的方法辅助去解释模型:\r\n\r\n### shap框架解释性\r\n\r\nSHAP基于Shapley值,Shapley值是经济学家Lloyd Shapley提出的博弈论概念。 它的核心思想是计算特征对模型输出的边际贡献,再从全局和局部两个层面对“黑盒模型”进行解释。如下几行代码就可以展示该模型的变量对于决策的影响,以Insterest历史利率为例,利率特征值越高(蓝色为低,红色为高),对应shap值越高,说明决策结果越趋近1(在本例金融风控项目里面也就是数值越大,越容易违约)\r\n```\r\n## 本文代码请见 https://github.com/aialgorithm/Blog/tree/master/projects/%E6%B5%B7%E5%A4%96%E9%87%91%E8%9E%8D%E9%A3%8E%E6%8E%A7%E5%AE%9E%E8%B7%B5\r\n\r\n### 需要先pip install shap\r\nimport shap\r\n\r\nexplainer = shap.TreeExplainer(lgb)\r\nshap_values = explainer.shap_values(pd.concat([train_x,test_x]))\r\nshap.summary_plot(shap_values[1], pd.concat([train_x,test_x]),max_display=5,plot_size=(5,5)) #特征重要性可视化\r\n\r\n```\r\n![](https://upload-images.jianshu.io/upload_images/11682271-a828118c24637545.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n### 其他模型可解释性框架\r\n- LIME\r\n\r\n在可解释性领域,最早出名的方法之一是LIME。它可以帮助解释机器学习模型正在学习什么以及为什么他们以某种方式预测。Lime目前支持对表格的数据,文本分类器和图像分类器的解释。\r\n\r\n\r\n知道为什么模型会以这种方式进行预测对于调整算法是至关重要的。借助LIME的解释,能够理解为什么模型以这种方式运行。如果模型没有按照计划运行,那么很可能在数据准备阶段就犯了错误。\r\n![](https://upload-images.jianshu.io/upload_images/11682271-d69e000701a57a83.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n-  Shapash \r\n\r\n“ Shapash是一个使机器学习对每个人都可以进行解释和理解Python库。Shapash提供了几种类型的可视化,显示了每个人都能理解的明确标签。数据科学家可以更轻松地理解他们的模型并分享结果。最终用户可以使用最标准的摘要来理解模型是如何做出判断的。”\r\n\r\nShapash库可以生成交互式仪表盘,并收集了许多可视化图表。与外形/石灰解释性有关。它可以使用SHAP/Lime作为后端,也就是说它只提供了更好看的图表。\r\n\r\n使用Shapash构建特征贡献图\r\n![](https://upload-images.jianshu.io/upload_images/11682271-a1620444c2a32143.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n- InterpretML\r\n\r\n\r\nInterpretML是一个开源的Python包,它向研究人员提供机器学习可解释性算法。InterpretML支持训练可解释模型(glassbox),以及解释现有的ML管道(blackbox)\r\n![](https://upload-images.jianshu.io/upload_images/11682271-7dd6456683cc323a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n\r\n- ELI5\r\n\r\n\r\nELI5是一个可以帮助调试机器学习分类器并解释它们的预测的Python库。目前支持以下机器学习框架:scikit-learn、XGBoost、LightGBM CatBoost、Keras\r\n\r\nELI5有两种主要的方法来解释分类或回归模型:检查模型参数并说明模型是如何全局工作的;检查模型的单个预测并说明什么模型会做出这样的决定。\r\n![](https://upload-images.jianshu.io/upload_images/11682271-f90b6206734f65c8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n- OmniXAI\r\n\r\n\r\nOmniXAI (Omni explained AI的简称),是Salesforce最近开发并开源的Python库。它提供全方位可解释的人工智能和可解释的机器学习能力来解决实践中机器学习模型在产生中需要判断的几个问题。对于需要在ML过程的各个阶段解释各种类型的数据、模型和解释技术的数据科学家、ML研究人员,OmniXAI希望提供一个一站式的综合库,使可解释的AI变得简单。\r\n![](https://upload-images.jianshu.io/upload_images/11682271-ece926050b715cd0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n\r\n\r\n\r\n## 二、微调树模型结构以符合业务解释性\r\n但是树模型的解释性也是有局限的,再了解树模型的决策逻辑后,不像逻辑回归(LR)可以较为轻松的调节特征分箱及模型去符合业务逻辑(如收入越低的人通常越可能信用卡逾期,模型决策时可能持相反的逻辑,这时就需要调整了)。\r\n\r\n我们一旦发现树结构或shap值不符合业务逻辑,由于树模型学习通常较复杂,想要依照业务逻辑去调整树结构就有点棘手了,所有很多时候只能推倒原来的模型,数据清洗、筛选、特征选择等 重新学习一个新的模型,直到特征决策在业务上面解释得通。\r\n\r\n在此,本文简单探讨一个可以快速对lightgbm树模型结构进行调整的方法。\r\n\r\n###  lightgbm结构\r\n\r\n首先导出lightgbm单棵树的结构及相应的模型文件:\r\n```\r\n# 本文代码 (https://github.com/aialgorithm/Blog)\r\n\r\nmodel.booster_.save_model(\"lgbmodel.txt\") # 导出模型文件\r\n```\r\n![](https://upload-images.jianshu.io/upload_images/11682271-b20f7bbebf1f5f76.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n```\r\ntree\r\nversion=v3\r\nnum_class=1\r\nnum_tree_per_iteration=1\r\nlabel_index=0\r\nmax_feature_idx=36\r\nobjective=binary sigmoid:1\r\nfeature_names=total_loan year_of_loan interest monthly_payment class work_year house_exist censor_status use post_code region debt_loan_ratio del_in_18month scoring_low scoring_high known_outstanding_loan known_dero pub_dero_bankrup recircle_b recircle_u initial_list_status app_type title policy_code f0 f1 f2 f3 f4 early_return early_return_amount early_return_amount_3mon issue_date_y issue_date_m issue_date_diff employer_type industry\r\nfeature_infos=[818.18181819999995:47272.727270000003] [3:5] [4.7789999999999999:33.978999999999999] [30.440000000000001:1503.8900000000001] [0:6] [0:10] [0:4] [0:2] [0:13] [0:901] [0:49] [0:509.3672727] [0:15] [540:910.90909090000002] [585:1131.818182] [1:59] [0:12] [0:9999] [0:779021] [0:120.6153846] [0:1] [0:1] [0:60905] none [0:9999] [0:9999] [0:9999] [2:9999] [0:9999] [0:5] [0:17446] [0:4821.8999999999996] [2007:2018] [1:12] [2830:6909] -1:4:3:2:0:1:5 -1:13:11:3:1:2:10:7:8:12:0:4:5:9:6\r\ntree_sizes=770\r\n\r\nTree=0\r\nnum_leaves=6\r\nnum_cat=0\r\nsplit_feature=30 2 16 15 2\r\nsplit_gain=3093.94 124.594 59.0243 46.1935 42.6584\r\nthreshold=1.0000000180025095e-35 9.9675000000000029 1.5000000000000002 17.500000000000004 15.961500000000003\r\ndecision_type=2 2 2 2 2\r\nleft_child=1 -1 3 -2 -3\r\nright_child=2 4 -4 -5 -6\r\nleaf_value=0.023461476907437533 -0.17987415362524772 0.10323905611372351 -0.026732447730002745 -0.10633877114664755 0.14703056722907529\r\nleaf_weight=147.41318297386169 569.9415502846241 502.41849474608898 30.554571613669395 100.48724548518658 399.18497054278851\r\nleaf_count=544 3633 1325 133 543 822\r\ninternal_value=-5.60284e-08 0.108692 -0.162658 -0.168852 0.122628\r\ninternal_weight=0 1049.02 700.983 670.429 901.603\r\ninternal_count=7000 2691 4309 4176 2147\r\nis_linear=0\r\nshrinkage=1\r\n\r\n\r\nend of trees\r\n\r\nfeature_importances:\r\ninterest=2\r\nknown_outstanding_loan=1\r\nknown_dero=1\r\nearly_return_amount=1\r\n\r\nparameters:\r\n[boosting: gbdt]\r\n[objective: binary]\r\n[metric: auc]\r\n[tree_learner: serial]\r\n[device_type: cpu]\r\n[data: ]\r\n[valid: ]\r\n[num_iterations: 1]\r\n[learning_rate: 0.1]\r\n[num_leaves: 6]\r\n[num_threads: -1]\r\n[deterministic: 0]\r\n[force_col_wise: 0]\r\n[force_row_wise: 0]\r\n[histogram_pool_size: -1]\r\n[max_depth: -1]\r\n[min_data_in_leaf: 20]\r\n[min_sum_hessian_in_leaf: 0.001]\r\n[bagging_fraction: 1]\r\n[pos_bagging_fraction: 1]\r\n[neg_bagging_fraction: 1]\r\n[bagging_freq: 0]\r\n[bagging_seed: 7719]\r\n[feature_fraction: 1]\r\n[feature_fraction_bynode: 1]\r\n[feature_fraction_seed: 2437]\r\n[extra_trees: 0]\r\n[extra_seed: 11797]\r\n[early_stopping_round: 0]\r\n[first_metric_only: 0]\r\n[max_delta_step: 0]\r\n[lambda_l1: 0]\r\n[lambda_l2: 0]\r\n[linear_lambda: 0]\r\n[min_gain_to_split: 0]\r\n[drop_rate: 0.1]\r\n[max_drop: 50]\r\n[skip_drop: 0.5]\r\n[xgboost_dart_mode: 0]\r\n[uniform_drop: 0]\r\n[drop_seed: 21238]\r\n[top_rate: 0.2]\r\n[other_rate: 0.1]\r\n[min_data_per_group: 100]\r\n[max_cat_threshold: 32]\r\n[cat_l2: 10]\r\n[cat_smooth: 10]\r\n[max_cat_to_onehot: 4]\r\n[top_k: 20]\r\n[monotone_constraints: ]\r\n[monotone_constraints_method: basic]\r\n[monotone_penalty: 0]\r\n[feature_contri: ]\r\n[forcedsplits_filename: ]\r\n[refit_decay_rate: 0.9]\r\n[cegb_tradeoff: 1]\r\n[cegb_penalty_split: 0]\r\n[cegb_penalty_feature_lazy: ]\r\n[cegb_penalty_feature_coupled: ]\r\n[path_smooth: 0]\r\n[interaction_constraints: ]\r\n[verbosity: -1]\r\n[saved_feature_importance_type: 0]\r\n[linear_tree: 0]\r\n[max_bin: 255]\r\n[max_bin_by_feature: ]\r\n[min_data_in_bin: 3]\r\n[bin_construct_sample_cnt: 200000]\r\n[data_random_seed: 38]\r\n[is_enable_sparse: 1]\r\n[enable_bundle: 1]\r\n[use_missing: 1]\r\n[zero_as_missing: 0]\r\n[feature_pre_filter: 1]\r\n[pre_partition: 0]\r\n[two_round: 0]\r\n[header: 0]\r\n[label_column: ]\r\n[weight_column: ]\r\n[group_column: ]\r\n[ignore_column: ]\r\n[categorical_feature: 35,36]\r\n[forcedbins_filename: ]\r\n[precise_float_parser: 0]\r\n[objective_seed: 8855]\r\n[num_class: 1]\r\n[is_unbalance: 0]\r\n[scale_pos_weight: 1]\r\n[sigmoid: 1]\r\n[boost_from_average: 1]\r\n[reg_sqrt: 0]\r\n[alpha: 0.9]\r\n[fair_c: 1]\r\n[poisson_max_delta_step: 0.7]\r\n[tweedie_variance_power: 1.5]\r\n[lambdarank_truncation_level: 30]\r\n[lambdarank_norm: 1]\r\n[label_gain: ]\r\n[eval_at: ]\r\n[multi_error_top_k: 1]\r\n[auc_mu_weights: ]\r\n[num_machines: 1]\r\n[local_listen_port: 12400]\r\n[time_out: 120]\r\n[machine_list_filename: ]\r\n[machines: ]\r\n[gpu_platform_id: -1]\r\n[gpu_device_id: -1]\r\n[gpu_use_dp: 0]\r\n[num_gpu: 1]\r\n\r\nend of parameters\r\n\r\npandas_categorical:[[\"\\u4e0a\\u5e02\\u4f01\\u4e1a\", \"\\u4e16\\u754c\\u4e94\\u767e\\u5f3a\", \"\\u5e7c\\u6559\\u4e0e\\u4e2d\\u5c0f\\u5b66\\u6821\", \"\\u653f\\u5e9c\\u673a\\u6784\", \"\\u666e\\u901a\\u4f01\\u4e1a\", \"\\u9ad8\\u7b49\\u6559\\u80b2\\u673a\\u6784\"], [\"\\u4ea4\\u901a\\u8fd0\\u8f93\\u3001\\u4ed3\\u50a8\\u548c\\u90ae\\u653f\\u4e1a\", \"\\u4f4f\\u5bbf\\u548c\\u9910\\u996e\\u4e1a\", \"\\u4fe1\\u606f\\u4f20\\u8f93\\u3001\\u8f6f\\u4ef6\\u548c\\u4fe1\\u606f\\u6280\\u672f\\u670d\\u52a1\\u4e1a\", \"\\u516c\\u5171\\u670d\\u52a1\\u3001\\u793e\\u4f1a\\u7ec4\\u7ec7\", \"\\u519c\\u3001\\u6797\\u3001\\u7267\\u3001\\u6e14\\u4e1a\", \"\\u5236\\u9020\\u4e1a\", \"\\u56fd\\u9645\\u7ec4\\u7ec7\", \"\\u5efa\\u7b51\\u4e1a\", \"\\u623f\\u5730\\u4ea7\\u4e1a\", \"\\u6279\\u53d1\\u548c\\u96f6\\u552e\\u4e1a\", \"\\u6587\\u5316\\u548c\\u4f53\\u80b2\\u4e1a\", \"\\u7535\\u529b\\u3001\\u70ed\\u529b\\u751f\\u4ea7\\u4f9b\\u5e94\\u4e1a\", \"\\u91c7\\u77ff\\u4e1a\", \"\\u91d1\\u878d\\u4e1a\"]]\r\n```\r\nlightgbm集成多棵二叉树的树模型,以如下一颗二叉树的一个父节点及其两个叶子分支具体解释(其他树及节点依此类推), 下面内部节点是以\r\n- 特征insterest(贷款利率)的数值 是否\u003c=15.962做的判断划分\r\n- 划分的增益gain 42.658\r\n-  样本权重 901.603\r\n- 该节点的样本数2147 占据了30.67%的数据\r\n- 该节点的如果不继续分裂叶子,获得的分数值是0.123\r\n划分后的两个叶子节点:\r\n- leaf2 分数值 0.103\r\n- leaf5 分数值 0.147\r\n分数值越高说明该叶子决策结果越趋近1(在本例金融风控项目里面也就是数值越大,越容易违约)\r\n![](https://upload-images.jianshu.io/upload_images/11682271-68a819408ef0d84f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n在金融风控领域是很注重决策的可解释性,有时我们可能发现某一个叶子节点的决策是不符合业务解释性的。比如,业务上认为利率越高 违约概率应该越低,那我们上图的节点就是不符合业务经验的(注:这里只是假设,实际上图节点的决策 还是符合业务经验的)\r\n\r\n\r\n那么这时最快微调树模型的办法就是直接对这个模型的这个叶子节点剪枝掉,只保留内部节点做决策。\r\n\r\n\r\n那么,如何快速地对lightgbm手动调整树结构(如剪枝)呢?\r\n\r\n\r\n\r\n\r\n###  lightgbm手动剪枝\r\n\r\n这里有个取巧的剪枝办法,可以在保留原始树结构的前提下,修改叶子节点的分数值为他们上级父节点的分数值,那逻辑上就等同于“剪枝”了\r\n- 剪枝前\r\n![](https://upload-images.jianshu.io/upload_images/11682271-68a819408ef0d84f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n对应的测试集的模型效果\r\n ![](https://upload-images.jianshu.io/upload_images/11682271-19ded7489acbaac5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n- 剪枝后 (修改叶子节点为父节点的分数)\r\n\r\n可以手动修改下模型文件对应叶子节点的分数值:\r\n![](https://upload-images.jianshu.io/upload_images/11682271-d29f8451854661ea.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n![](https://upload-images.jianshu.io/upload_images/11682271-ea3b7c545d9a280e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n\r\n我们再验证下剪枝前后,测试集的模型效果差异:auc降了1%,ks变化不大;\r\n![](https://upload-images.jianshu.io/upload_images/11682271-ae0bf783ee989495.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\r\n\r\n\r\n通过剪枝去优化模型复杂度或者去符合合理业务经验,对模型带来都是正则化效果模型可以减少统计噪音的影响(减少过拟合),有更好的泛化效果。\r\n\r\n\r\n\r\n当然本方法建立在小规模的集成学习树模型,如果动则几百上千颗的大规模树模型,人为调整每一颗的树结构,这也不现实。。\r\n\r\n\r\n","author":{"url":"https://github.com/aialgorithm","@type":"Person","name":"aialgorithm"},"datePublished":"2022-09-25T03:13:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/59/Blog/issues/59"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b22b9db5-f721-3e15-acff-d9dd112ca607
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDACE:33C049:CBAF43:1163A19:6969ED16
html-safe-nonce62549b14391079930827297bcd6d9092cd36133601b51f3560242ea3c0d0e35f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUNFOjMzQzA0OTpDQkFGNDM6MTE2M0ExOTo2OTY5RUQxNiIsInZpc2l0b3JfaWQiOiIyOTQ0OTg5OTIzMzY3MzE2NzU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac4605dcd46e79e789b81388890be260b6d392a3a6cc7f1eb8b365cec2afd53e27
hovercard-subject-tagissue:1384880716
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/aialgorithm/Blog/59/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3556fd3cbe5e7dfc26bd809dd50797dec80938bd8a96889f3c628438f5a8b727/aialgorithm/Blog/issues/59
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3556fd3cbe5e7dfc26bd809dd50797dec80938bd8a96889f3c628438f5a8b727/aialgorithm/Blog/issues/59
og:image:alt本文示例沿用之前文章的数据:一文梳理金融风控建模全流程(Python)) 一、树模型的解释性 集成学习树模型因为其强大的非线性能力及解释性,在表格类数据挖掘等任务中应用频繁且表现优异。 模型解释性对于某些领域(如金融风控)是极为看重的,对于树模型的解释性,我们常常可以通过输出树模型的结构或使用shap等解释性框架的方法 graphviz 输出树结构 # 需要先安装https://graphv...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameaialgorithm
hostnamegithub.com
expected-hostnamegithub.com
None7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8
turbo-cache-controlno-preview
go-importgithub.com/aialgorithm/Blog git https://github.com/aialgorithm/Blog.git
octolytics-dimension-user_id33707637
octolytics-dimension-user_loginaialgorithm
octolytics-dimension-repository_id147093233
octolytics-dimension-repository_nwoaialgorithm/Blog
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id147093233
octolytics-dimension-repository_network_root_nwoaialgorithm/Blog
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasebdde15ad1b403e23b08bbd89b53fbe6bdf688cad
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/aialgorithm/Blog/issues/59#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Faialgorithm%2FBlog%2Fissues%2F59
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Faialgorithm%2FBlog%2Fissues%2F59
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=aialgorithm%2FBlog
Reloadhttps://github.com/aialgorithm/Blog/issues/59
Reloadhttps://github.com/aialgorithm/Blog/issues/59
Reloadhttps://github.com/aialgorithm/Blog/issues/59
aialgorithm https://github.com/aialgorithm
Bloghttps://github.com/aialgorithm/Blog
Notifications https://github.com/login?return_to=%2Faialgorithm%2FBlog
Fork 259 https://github.com/login?return_to=%2Faialgorithm%2FBlog
Star 942 https://github.com/login?return_to=%2Faialgorithm%2FBlog
Code https://github.com/aialgorithm/Blog
Issues 66 https://github.com/aialgorithm/Blog/issues
Pull requests 0 https://github.com/aialgorithm/Blog/pulls
Actions https://github.com/aialgorithm/Blog/actions
Projects 0 https://github.com/aialgorithm/Blog/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/aialgorithm/Blog/security
Please reload this pagehttps://github.com/aialgorithm/Blog/issues/59
Insights https://github.com/aialgorithm/Blog/pulse
Code https://github.com/aialgorithm/Blog
Issues https://github.com/aialgorithm/Blog/issues
Pull requests https://github.com/aialgorithm/Blog/pulls
Actions https://github.com/aialgorithm/Blog/actions
Projects https://github.com/aialgorithm/Blog/projects
Security https://github.com/aialgorithm/Blog/security
Insights https://github.com/aialgorithm/Blog/pulse
New issuehttps://github.com/login?return_to=https://github.com/aialgorithm/Blog/issues/59
New issuehttps://github.com/login?return_to=https://github.com/aialgorithm/Blog/issues/59
树模型决策的可解释性与微调(Python)https://github.com/aialgorithm/Blog/issues/59#top
https://github.com/aialgorithm
https://github.com/aialgorithm
aialgorithmhttps://github.com/aialgorithm
on Sep 25, 2022https://github.com/aialgorithm/Blog/issues/59#issue-1384880716
一文梳理金融风控建模全流程(Python)https://mp.weixin.qq.com/s?__biz=MzI4MDE1NjExMQ==&mid=2247489574&idx=1&sn=98ca40dd2775428963b50a05e3a1f06c&chksm=ebbd9a86dcca1390c85fe18b330db1f8c0458a783a8d327c65a74fbcb38f2b72390dc64c4fe2&scene=178&cur_album_id=1986073923821551618#rd
https://camo.githubusercontent.com/cf468f2ff3b9cd05daacf0dc6cfcd9430e9c5fbfb7c664f93442b801a4762d8b/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d396461623538363036656366373838632e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://www.cs.sjtu.edu.cn/~kzhu/papers/kzhu-infocode.pdf),很难理解。。接下介绍下常用的几种框架的方法辅助去解释模型:https://www.cs.sjtu.edu.cn/~kzhu/papers/kzhu-infocode.pdf%EF%BC%89%EF%BC%8C%E5%BE%88%E9%9A%BE%E7%90%86%E8%A7%A3%E3%80%82%E3%80%82%E6%8E%A5%E4%B8%8B%E4%BB%8B%E7%BB%8D%E4%B8%8B%E5%B8%B8%E7%94%A8%E7%9A%84%E5%87%A0%E7%A7%8D%E6%A1%86%E6%9E%B6%E7%9A%84%E6%96%B9%E6%B3%95%E8%BE%85%E5%8A%A9%E5%8E%BB%E8%A7%A3%E9%87%8A%E6%A8%A1%E5%9E%8B%EF%BC%9A
https://camo.githubusercontent.com/419cd77c6877894bbaac93a55be23fc9a559306e82a5c2d954973d1186637a13/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d613832383131386332343633373534352e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/063ec6d24410cdd0dc07d42e9e0e1b86f7f78378bacc405de9e349d2932401a6/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d643639653030303730316135376138332e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/b89fad4b58193307737f314d4623c42936de7a91bf6d7f2143059369021c41e1/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d613136323034343463326133323134332e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/742cb1c3262e330b2d81d6a488e2c8b7da045d1024e5bd8da86eae5e0dc6422c/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d376464363435363638336363333233612e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/5d8ab79e9fcaf2780b6d9d65f2175b29181e38464c2733392d20faf7c26cb1f4/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d663930623632303637333466363563382e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/4d49684700e49f130fd6492c3660a24a073c90623e8e292072ab2534c82ec58d/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d656365393236303530623731356364302e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/6b4efdbeb9b2a15288146af2d03f1e8b721aed32e813558ffc7d7bf88306812e/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d623230663762626562663166356637362e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/6de02fde52b6c2d7b680f55340cfd19f853a842fbd1ba80714e458d11d88dac6/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d363861383139343038656630643834662e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/6de02fde52b6c2d7b680f55340cfd19f853a842fbd1ba80714e458d11d88dac6/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d363861383139343038656630643834662e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/df52602b47f482248d9988cb39d7eba0b3da12f83711e07c36465c29c721b3a4/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d313964656437343839616362616163352e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/c4df299578f36aee7db1fa25818e0df793d8f1f2abaa08d17e9e1d8c5f4ba19b/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d643239663834353138353436363165612e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/f930fc12b925f31299a41f19c7c9339bb9f412b71041107481f1f42a21dd289c/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d656133623763353435643961323830652e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://camo.githubusercontent.com/d76cf533f85f145c41ec07b6c80aa20a6797841e6c5de020c0857134919b442d/68747470733a2f2f75706c6f61642d696d616765732e6a69616e7368752e696f2f75706c6f61645f696d616765732f31313638323237312d616530626637383365653938393439352e706e673f696d6167654d6f6772322f6175746f2d6f7269656e742f7374726970253743696d61676556696577322f322f772f31323430
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.