【工具】survex一个解释机器学习生存模型的R包

文章目录

介绍

由于其灵活性和优越的性能,机器学习模型经常补充并优于传统的统计生存模型。然而,由于缺乏用户友好的工具来解释其内部操作和预测原理,它们的广泛采用受到阻碍。为了解决这个问题,我们引入了survex R包,它提供了一个内聚框架,通过应用可解释的人工智能技术来解释任何生存模型。所提出的软件的功能包括理解和诊断生存模型,这可以导致它们的改进。通过揭示决策过程的洞察力,例如变量效应和重要性,survex能够评估模型的可靠性和检测偏差。因此,可以在诸如生物医学研究和保健应用等敏感领域促进透明度和责任。

Due to their flexibility and superior performance, machine learning models frequently complement and outperform traditional statistical survival models. However, their widespread adoption is hindered by a lack of user-friendly tools to explain their internal operations and prediction rationales. To tackle this issue, we introduce the survex R package, which provides a cohesive framework for explaining any survival model by applying explainable artificial intelligence techniques. The capabilities of the proposed software encompass understanding and diagnosing survival models, which can lead to their improvement. By revealing insights into the decision-making process, such as variable effects and importances, survex enables the assessment of model reliability and the detection of biases. Thus, transparency and responsibility may be promoted in sensitive areas, such as biomedical research and healthcare applications.

代码

案例

r 复制代码
library(survex)
library(survival)
library(ranger)

vet <- survival::veteran

cph <- coxph(Surv(time, status) ~ ., data = vet, x = TRUE, model = TRUE)
exp <- explain(cph, data = vet[, -c(3,4)], y = Surv(vet$time, vet$status))
#> Preparation of a new explainer is initiated 
#>   -> model label       :  coxph (  default  ) 
#>   -> data              :  137  rows  6  cols 
#>   -> target variable   :  137  values ( 128 events and 9 censored ) 
#>   -> times             :  50 unique time points , min = 1.5 , median survival time = 80 , max = 999 
#>   -> times             :  (  generated from y as uniformly distributed survival quantiles based on Kaplan-Meier estimator  ) 
#>   -> predict function  :  predict.coxph with type = 'risk' will be used (  default  ) 
#>   -> predict survival function  :  predictSurvProb.coxph will be used (  default  ) 
#>   -> predict cumulative hazard function  :  -log(predict_survival_function) will be used (  default  ) 
#>   -> model_info        :  package survival , ver. 3.7.0 , task survival (  default  ) 
#>   A new explainer has been created!


shap <- model_survshap(exp, veteran[c(1:4, 17:20, 110:113, 126:129), -c(3,4)])

plot(shap)

参考

  • survex: an R package for explaining machine learning survival models
相关推荐
Ray Liang4 小时前
一小时手搓轻量级可代替 Qdrant 的向量数据库
人工智能·架构设计·mindx·qrant
aircrushin4 小时前
国产大模型全球逆袭的技术与商业逻辑
人工智能
iceiceiceice4 小时前
从零开始构建 RAG + DeepSeek Demo
人工智能·llm
掘金安东尼5 小时前
养龙虾之前?先搞懂 Skills!
人工智能
chaors6 小时前
从零学RAG0x03第一个实战应用:医疗知识混合检索实战
人工智能·aigc·ai编程
阿聪谈架构6 小时前
第02章:Prompt 工程 —— 用语言精准指挥 AI
人工智能
suke7 小时前
AI 界的 npm 惨案重演?聊聊 龙虾OpenClaw skills那些带毒的“骚操作
人工智能·程序员·aigc
明明如月学长7 小时前
OpneClaw 总挂?配个"保镖"自动修,7x24小时不用管
人工智能
万少7 小时前
用 OpenClaw 实现小红书自动发帖
人工智能
阿聪谈架构8 小时前
第01章:从零开始调用 LLM —— 入门 Qwen 大模型 API
人工智能