我正在探索生存模型,即“Cox Proportional-Hazards Model”。我想使用 for 循环来运行模型的多个属性。
attributelist= ['alpha',
'baseline_cumulative_hazard_',
'baseline_estimation_method',
'baseline_hazard_',
'baseline_survival_',
'check_assumptions',
'cluster_col',
'compute_followup_hazard_ratios',
'compute_residuals',
'concordance_index_',
'confidence_intervals_',
'duration_col']
只是 Cox-PH 模型可用的“属性”片段。
由于我仍在学习该模型及其潜在输出,因此我想尝试运行所有内容以查看它抛出了什么。
我想写一些类似的东西:
cph = CoxPHFitter()
cph.fit(df, 'tenure', event_col='event')
--------------------------------------------------
for i in attributelist:
print(cph.i) # Is there a better way to do this instead of printing?
有谁知道我们如何做到这一点?(我知道阅读文档会有所帮助,但作为一个人,我更亲力亲为!)