Skip to content

Instantly share code, notes, and snippets.

View hrzn's full-sized avatar

Julien Herzen hrzn

View GitHub Profile
hierarchy = dict()
# Fill in grouping by reason
for reason in reasons:
hierarchy[reason] = ["Total"]
# Fill in grouping by region
for region in regions:
hierarchy[region] = ["Total"]
reasons = ["Hol", "VFR", "Bus", "Oth"]
regions = ["NSW", "VIC", "QLD", "SA", "WA", "TAS", "NT"]
city_labels = ["city", "noncity"]
tourism_series["Total"].plot(label="total", lw=12, color="grey")
sum([tourism_series[region] for region in regions]).plot(
label="sum regions", lw=7, color="orange"
)
sum([tourism_series[reason] for reason in reasons]).plot(
label="sum reasons", lw=3, color="blue"
sum_city_noncity = (
tourism_series["NSW - hol - city"] + tourism_series["NSW - hol - noncity"]
)
sum_city_noncity.plot(label="NSW - hol, city+noncity", lw=8, color="grey")
tourism_series["NSW - hol"].plot(color="orange")
tourism_series[["Total", "NSW", "NSW - bus", "NSW - hol", "NSW - bus - city"]].plot()
tourism_series = AustralianTourismDataset().load()
# load M3 dataset
m3_train, m3_test = load_m3()
# naive last
naive1_smapes_m3, naive1_time_m3 = eval_local_model(
m3_train, m3_test, NaiveSeasonal, K=1
)
# naive seasonal
naive12_smapes_m3, naive12_time_m3 = eval_local_model(
theta_smapes_m3, theta_time_m3 = eval_local_model(m3_train, m3_test, Theta)
ets_smapes_m3, ets_time_m3 = eval_local_model(m3_train, m3_test, ExponentialSmoothing)
naive12_smapes_m3, naive12_time_m3 = eval_local_model(
m3_train, m3_test, NaiveSeasonal, K=12
)
naive1_smapes_m3, naive1_time_m3 = eval_local_model(
m3_train, m3_test, NaiveSeasonal, K=1
)