我想要print_summary
输出的前6行。我该怎么做?你知道吗
我有cox.print_summary()
的全部摘要。
cox.summary()
为列details I提供了数据帧格式,但是索引摘要并没有提供数据集审查摘要
cph = CoxPHFitter()
cph.fit(self.data_train, duration_col='time', event_col='dead')
cph.print_summary()
'''<lifelines.CoxPHFitter: fitted with 6373 observations, 1974 censored>
duration col = 'time'
event col = 'dead'
number of subjects = 6373
number of events = 4399
log-likelihood = -34779.52
time fit was run = 2019-05-09 06:28:06 UTC
---
coef exp(coef) se(coef) z p -log2(p) lower 0.95 upper 0.95
dzgroupCHF 0.49 1.64 0.06 8.19 <0.005 51.79 0.37 0.61
dzgroupCirrhosis 0.55 1.73 0.08 6.71 <0.005 35.63 0.39 0.71
等等
results = self.cph.summary
print(results.head())
这将以df格式给出变量的详细信息。但我想:
'''<lifelines.CoxPHFitter: fitted with 6373 observations, 1974 censored>
duration col = 'time'
event col = 'dead'
number of subjects = 6373
number of events = 4399
log-likelihood = -34779.52
time fit was run = 2019-05-09 06:28:06 UTC
索引给出错误:
cph.print_summary()[0:9]
TypeError: 'NoneType' object is not subscriptable
其中大多数是模型上可以直接访问的属性。查看代码,打印摘要如下所示:
因此可以使用
self._log_likelihood
或self._n_examples
等访问所需的值未来的一些工作可能会使提取这些数据变得更容易:https://github.com/CamDavidsonPilon/lifelines/issues/721#issuecomment-497180538
相关问题 更多 >
编程相关推荐