forked from cognizant-ai-labs/covid-xprize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
predict.py
51 lines (46 loc) · 2.47 KB
/
predict.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright 2020 (c) Cognizant Digital Business, Evolutionary AI. All rights reserved. Issued under the Apache 2.0 License.
import argparse
def predict(start_date: str,
end_date: str,
path_to_ips_file: str,
output_file_path) -> None:
"""
Generates and saves a file with daily new cases predictions for the given countries, regions and intervention
plans, between start_date and end_date, included.
:param start_date: day from which to start making predictions, as a string, format YYYY-MM-DDD
:param end_date: day on which to stop making predictions, as a string, format YYYY-MM-DDD
:param path_to_ips_file: path to a csv file containing the intervention plans between inception date (Jan 1 2020)
and end_date, for the countries and regions for which a prediction is needed
:param output_file_path: path to file to save the predictions to
:return: Nothing. Saves the generated predictions to an output_file_path CSV file
with columns "CountryName,RegionName,Date,PredictedDailyNewCases"
"""
# !!! YOUR CODE HERE !!!
raise NotImplementedError
# !!! PLEASE DO NOT EDIT. THIS IS THE OFFICIAL COMPETITION API !!!
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--start_date",
dest="start_date",
type=str,
required=True,
help="Start date from which to predict, included, as YYYY-MM-DD. For example 2020-08-01")
parser.add_argument("-e", "--end_date",
dest="end_date",
type=str,
required=True,
help="End date for the last prediction, included, as YYYY-MM-DD. For example 2020-08-31")
parser.add_argument("-ip", "--interventions_plan",
dest="ip_file",
type=str,
required=True,
help="The path to an intervention plan .csv file")
parser.add_argument("-o", "--output_file",
dest="output_file",
type=str,
required=True,
help="The path to the CSV file where predictions should be written")
args = parser.parse_args()
print(f"Generating predictions from {args.start_date} to {args.end_date}...")
predict(args.start_date, args.end_date, args.ip_file, args.output_file)
print("Done!")