本文整理汇总了Python中lifelines.estimation.AalenAdditiveFitter.predict_cumulative_hazard方法的典型用法代码示例。如果您正苦于以下问题:Python AalenAdditiveFitter.predict_cumulative_hazard方法的具体用法?Python AalenAdditiveFitter.predict_cumulative_hazard怎么用?Python AalenAdditiveFitter.predict_cumulative_hazard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lifelines.estimation.AalenAdditiveFitter
的用法示例。
在下文中一共展示了AalenAdditiveFitter.predict_cumulative_hazard方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_predict_cumulative_hazard_inputs
# 需要导入模块: from lifelines.estimation import AalenAdditiveFitter [as 别名]
# 或者: from lifelines.estimation.AalenAdditiveFitter import predict_cumulative_hazard [as 别名]
def test_predict_cumulative_hazard_inputs(self, data_pred1):
aaf = AalenAdditiveFitter()
aaf.fit(data_pred1, duration_col='t', event_col='E',)
x = data_pred1.ix[:5].drop(['t', 'E'], axis=1)
y_df = aaf.predict_cumulative_hazard(x)
y_np = aaf.predict_cumulative_hazard(x.values)
assert_frame_equal(y_df, y_np)
示例2: test_nn_cumulative_hazard_will_set_cum_hazards_to_0
# 需要导入模块: from lifelines.estimation import AalenAdditiveFitter [as 别名]
# 或者: from lifelines.estimation.AalenAdditiveFitter import predict_cumulative_hazard [as 别名]
def test_nn_cumulative_hazard_will_set_cum_hazards_to_0(self, rossi):
aaf = AalenAdditiveFitter(nn_cumulative_hazard=False)
aaf.fit(rossi, event_col='arrest', duration_col='week')
cum_hazards = aaf.predict_cumulative_hazard(rossi)
assert (cum_hazards < 0).stack().mean() > 0
aaf = AalenAdditiveFitter(nn_cumulative_hazard=True)
aaf.fit(rossi, event_col='arrest', duration_col='week')
cum_hazards = aaf.predict_cumulative_hazard(rossi)
assert (cum_hazards < 0).stack().mean() == 0