def predict_year_by_year(self,tr,cut_point,duration,spontaneous,w1,alpha,w2):
N = tr.shape[1]
pred = []
for t in range(cut_point+1,cut_point+duration+1):
delta_ct = spontaneous/w1*(numpy.exp(-w1*(t-1))-numpy.exp(-w1*t)) + \
alpha/w2*(numpy.sum(numpy.exp(-w2*((t-1)-tr)))-numpy.sum(numpy.exp(-w2*(t-tr))))
delta_ct = delta_ct[0,0]
if len(pred) == 0:
ct = N + delta_ct
else :
ct = pred[-1] + delta_ct
tr = tr.tolist()[0]
tr.extend([t for i in range(int(delta_ct))])
tr = numpy.mat(tr)
pred.append(ct)
return pred
评论列表
文章目录