我有以下数据:
gasdfhourly[['Unit','Hourcount','Target']].head()
Out[377]:
Unit Hourcount Target
Date hour
2014-01-01 0 748.816493 1 0.0
1 759.759946 2 0.0
2 756.737007 3 0.0
3 761.075262 4 0.0
4 765.142517 5 0.0
我试着用考克斯博士的模型来适应它:
from lifelines import CoxPHFitter
cph = CoxPHFitter()
cph.fit(gasdfhourly, duration_col='Hourcount', event_col='Target', show_progress=False)
cph.print_summary()
X=gasdfhourly['Unit']
cph.predict_survival_function(X)
我得到以下错误:
Traceback (most recent call last):
File "", line 1, in
cph.predict_survival_function(X)
File "C:\ProgramData\Anaconda3\lib\site-packages\lifelines\fitters\coxph_fitter.py", line 514, in predict_survival_function
return exp(-self.pre