1

我正在使用lifelinesPython 上的包运行 Cox PH 模型。

我觉得奇怪的是,如果我在整个数据上运行模型,运行它没有问题,但是当我进行交叉验证(使用包自己的验证功能)时,会出现收敛错误。

知道如何解决这个问题吗?文档建议使用惩罚器,但我还没有找到让我运行这个东西的值。

如果您想知道,这是我的代码:

# Gone right
cph = CoxPHFitter()
cph.fit(daten, "length_of_arrears2", event_col='cured2')

# Gone wrong
cph = CoxPHFitter(penalizer=10)
scores = k_fold_cross_validation(cph, daten, 'length_of_arrears2', event_col='cured2', k=5)

这是它输出的错误:

ConvergenceError: Convergence halted due to matrix inversion problems. Suspicion is high collinearity. Please see the following tips in the lifelines documentation: https://lifelines.readthedocs.io/en/latest/Examples.html#problems-with-convergence-in-the-cox-proportional-hazard-modelMatrix is singular.

我检查了相关表,一些变量非常相关,但对我来说仍然有点奇怪,它适用于完整的东西,但不适用于交叉 val。

有没有一种在不完全删除变量的情况下摆脱高相关性的好方法?

编辑:

我对它进行了更多测试。首先,我删除了所有相关性超过 0.74 的变量,这在 KFold 方法中不起作用。

然后,我手动将数据拆分为 90/10,它起作用了,所以我一直尝试到 70/30,因为 60/40 还没有起作用。任何想法?

4

0 回答 0