diff options
author | Ta180m | 2020-05-02 15:25:32 -0500 |
---|---|---|
committer | Ta180m | 2020-05-02 15:25:32 -0500 |
commit | 2485953be4d3b81ae65244b5b31cb5bf2b5f9524 (patch) | |
tree | c454615a348819fd98e4f72a5691d111c629e46b /solver2.py | |
parent | ffc65c7b25d16520301724b441ee2e17a15ce8b7 (diff) |
Redo tests
Diffstat (limited to 'solver2.py')
-rw-r--r-- | solver2.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -148,7 +148,7 @@ class Learner(object): df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: file.write(f'Beta: {beta}\nGamma: {gamma}\nR0: {beta/gamma}\n') - file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}\nActual I: {extended_actual[-1] * correction_factor}') elif args.mode == 'SIR': optimal = minimize( loss_sir, @@ -164,7 +164,7 @@ class Learner(object): df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: file.write(f'Beta: {beta}\nGamma: {gamma}\nR0: {beta/gamma}\n') - file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}\nActual I: {extended_actual[-1] * correction_factor}') elif args.mode == 'ESIR': optimal = minimize( loss_esir, @@ -180,7 +180,7 @@ class Learner(object): df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: file.write(f'Beta: {beta}\nGamma: {gamma}\nMu: {mu}\nR0: {beta/(gamma + mu)}\n') - file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}\nActual I: {extended_actual[-1] * correction_factor}') elif args.mode == 'SEIR': # exposed_data = self.load_exposed(self.country) @@ -198,7 +198,7 @@ class Learner(object): df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: file.write(f'Beta: {beta}\nGamma: {gamma}\nMu: {mu}\nSigma: {sigma}\nR0: {(beta * sigma)/((mu + gamma) * (mu + sigma))}\n') - file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}\nActual I: {extended_actual[-1] * correction_factor}') fig, ax = plt.subplots(figsize=(15, 10)) ax.set_title(f'{args.disease} cases over time ({args.mode} Model)') df.plot(ax=ax) |