Given an airport's total monthly passenger counts for a period of NN months, forecast its passenger count for the next 12 months.
The first line contains an integer, $N$, denoting the number of months of passenger data. The $N$ subsequent lines each contain the monthly passenger counts in the form of 2 tab-separated values:
1. The first value is $MonthNum_X$, where $X$ is an an integer denoting the month number.
2. The second value is an integer denoting the number of passengers for that month.
The final score obtained upon submitting your code is solely dependent on the hidden test case. We will compute the mean of the magnitude of the percentage difference by comparing your expected answers with the actual sessions for each of the missing records in all test cases (samples included).
$d = MAE \times 100$
$d$ is the mean absolute error times 100. If $d$ is over 40 you get a score of 0
$N < 150$
For each $i$ from 1 to 12, print the forecasted passenger count for month $N + i$. In other words, project the next twelve months after the data set ends.
In [1]:
SAMPLE_INPUT = """60
MonthNum_1 1226800
MonthNum_2 926891
MonthNum_3 782725
MonthNum_4 1023038
MonthNum_5 1126293
MonthNum_6 692565
MonthNum_7 1165880
MonthNum_8 1207156
MonthNum_9 1129954
MonthNum_10 745100
MonthNum_11 1059346
MonthNum_12 1168555
MonthNum_13 1317458
MonthNum_14 528045
MonthNum_15 1220238
MonthNum_16 874557
MonthNum_17 1033389
MonthNum_18 1034165
MonthNum_19 812094
MonthNum_20 1351419
MonthNum_21 801822
MonthNum_22 1044266
MonthNum_23 722871
MonthNum_24 742100
MonthNum_25 839471
MonthNum_26 1201199
MonthNum_27 796265
MonthNum_28 953887
MonthNum_29 1124602
MonthNum_30 1070181
MonthNum_31 1160366
MonthNum_32 1131150
MonthNum_33 1151813
MonthNum_34 1065316
MonthNum_35 914800
MonthNum_36 1093034
MonthNum_37 937898
MonthNum_38 991612
MonthNum_39 865649
MonthNum_40 990565
MonthNum_41 965414
MonthNum_42 949248
MonthNum_43 1168905
MonthNum_44 593112
MonthNum_45 1156922
MonthNum_46 870095
MonthNum_47 1023262
MonthNum_48 788327
MonthNum_49 543605
MonthNum_50 510786
MonthNum_51 734714
MonthNum_52 1133025
MonthNum_53 1461091
MonthNum_54 635481
MonthNum_55 1104107
MonthNum_56 844960
MonthNum_57 1271967
MonthNum_58 574319
MonthNum_59 1063900
MonthNum_60 724737"""
In [70]:
# python standard library
from io import StringIO
# third party
import matplotlib
import pandas
import seaborn
In [71]:
%matplotlib inline
In [67]:
lines = SAMPLE_INPUT.split('\n')[1:]
lines = '\n'.join(lines)
line_stream = StringIO(unicode(lines))
In [68]:
data = pandas.read_csv(line_stream, sep='\s+', header=None, names='month passengers'.split())
#del(data['month'])
In [69]:
Out[69]: