Open hlin863 opened 2 years ago
sample_infected = CI[0 : int((i / 30) * len(t))] # sample the infected population
sample_time = t[0 : int((i / 30) * len(t))] # sample the time
# print(sample_infected) # print the sample infected population
# print(sample_time) # print the sample time
p0 = [1000, 10, 1] # initialize p0 as initial population
popt, pcov = curve_fit(logistic_fit, sample_time, sample_infected, p0) # perform curve fitting
a_f = popt[0] # fitted constant for determining the probability of infection
b_f = popt[1] # fitted constant for determining the probability of recovery
c_f = popt[2] # fitted constant for determining the probability of recovery
for i in range(len(t)):
sample_infected.append(logistic_fit(t[i], a_f, b_f, c_f)) # append the fitted curve to the sample infected population
Please check the curve_fit()
process to determining whether the fit values are suitable value and whether the predicted values are distorting the error value - abs(sample_infected[-1] - CI[-1])
.
https://github.com/hlin863/group_project_technical_solution/blob/a8b7649816d87842fbccb0e4592a412f89168748/average_error.py#L102
For some reason, in the middle stages, the error suddenly becomes large values. Please check if why the error is increasing and fix the issue