Commit 45420867 authored by mrsuperficial's avatar mrsuperficial
Browse files

date fix

parent a668f2c5
forecast_date,target,horizon,q0.025,q0.25,q0.5,q0.75,q0.975
2021-11-10,DAX,1 day,-1.814,-0.319,0.107,0.585,1.644
2021-11-10,DAX,2 day, -1.895,-0.392,0.135,0.703,2.350
2021-11-10,DAX,5 day,-2.130,-0.480,0.228,0.979,3.269
2021-11-10,DAX,6 day,-2.012,-0.477,0.240,1.097,3.330
2021-11-10,DAX,7 day,-2.563,-0.315,0.404,1.243,3.206
2021-11-10,temperature,36 hour,-0.02505758,3.889791 ,5.574968 ,7.260145 , 11.17499
2021-11-10,temperature,48 hour,-0.34429335,3.652610 ,5.373108 ,7.093605 ,11.09051
2021-11-10,temperature,60 hour,-0.49696121,3.613992 ,5.383584 ,7.153175 ,11.26413
2021-11-10,temperature,72 hour,-0.61484476,3.579935 ,5.385610 ,7.191285 ,11.38606
2021-11-10,temperature,84 hour,-0.72564287,3.546917 ,5.386073 ,7.225229 ,11.49779
2021-11-10,wind,36 hour,14.27400 ,15.74250 ,17.48000 ,18.75000 ,20.25925
2021-11-10,wind,48 hour,16.11750 ,18.38750 ,19.15000 ,20.25750 ,21.05025
2021-11-10,wind,60 hour,18.83750 ,19.58500 ,21.08500 ,21.86250 ,22.80025
2021-11-10,wind,72 hour,15.47475 ,16.54750 ,17.60500 ,18.75500 ,19.95700
2021-11-10,wind,84 hour,12.82375 ,16.45500 ,17.52500 ,19.11750 ,21.80400
2021-11-17,DAX,1 day,-1.814,-0.319,0.107,0.585,1.644
2021-11-17,DAX,2 day, -1.895,-0.392,0.135,0.703,2.350
2021-11-17,DAX,5 day,-2.130,-0.480,0.228,0.979,3.269
2021-11-17,DAX,6 day,-2.012,-0.477,0.240,1.097,3.330
2021-11-17,DAX,7 day,-2.563,-0.315,0.404,1.243,3.206
2021-11-17,temperature,36 hour,-0.02505758,3.889791 ,5.574968 ,7.260145 , 11.17499
2021-11-17,temperature,48 hour,-0.34429335,3.652610 ,5.373108 ,7.093605 ,11.09051
2021-11-17,temperature,60 hour,-0.49696121,3.613992 ,5.383584 ,7.153175 ,11.26413
2021-11-17,temperature,72 hour,-0.61484476,3.579935 ,5.385610 ,7.191285 ,11.38606
2021-11-17,temperature,84 hour,-0.72564287,3.546917 ,5.386073 ,7.225229 ,11.49779
2021-11-17,wind,36 hour,14.27400 ,15.74250 ,17.48000 ,18.75000 ,20.25925
2021-11-17,wind,48 hour,16.11750 ,18.38750 ,19.15000 ,20.25750 ,21.05025
2021-11-17,wind,60 hour,18.83750 ,19.58500 ,21.08500 ,21.86250 ,22.80025
2021-11-17,wind,72 hour,15.47475 ,16.54750 ,17.60500 ,18.75500 ,19.95700
2021-11-17,wind,84 hour,12.82375 ,16.45500 ,17.52500 ,19.11750 ,21.80400
%% Cell type:markdown id:21c7e0a5-58d8-4838-b35a-5ab49c615cdf tags:
# Submission Analysis
This notebook is meant to analyze and present some statistics of the submissions
%% Cell type:code id:77dd7168-5910-42f8-81c3-bb303a7bf03b tags:
``` python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
```
%% Cell type:code id:34c96705-82d6-446c-b028-da6611eb56cd tags:
``` python
%matplotlib inline
%config InlineBackend.figure_format='retina'
```
%% Cell type:code id:bb79853e-1f3d-48e4-81db-4d1daba94c81 tags:
``` python
from datetime import datetime as dtm
import os
```
%% Cell type:code id:ccd8c14c-c772-4b2b-81cd-c95cba4f3a20 tags:
``` python
tod = dtm.today().strftime("%Y%m%d")
tod
```
%% Output
'20211118'
%% Cell type:code id:1c104a89-0abd-4630-8397-d1d62e793d47 tags:
``` python
all_subm_folders = [f.path[3:] for f in os.scandir("../") if f.is_dir() if f.path[3:].isdigit()]
past_subm_folders = [f for f in all_subm_folders if dtm.strptime(f,"%Y%m%d").date() < dtm.today().date()]
past_subm_folders
```
%% Output
['20211110', '20211027', '20211020', '20211117', '20211103']
%% Cell type:code id:91ce45e6-9265-4745-966d-7e5681a2fec1 tags:
``` python
all_dfs = []
for folder in past_subm_folders:
df_paths = [f.path for f in os.scandir("../"+folder) if f.path[12:].startswith("2021")]
week_dfs = []
for dfp in df_paths:
df = pd.read_csv(dfp)
df["name"] = dfp[dfp.find("_")+1:-4]
week_dfs.append(df)
week_df = pd.concat(week_dfs)
if "Unnamed: 0" in week_df.columns:
week_df.drop(columns=["Unnamed: 0"], inplace=True)
all_dfs.append(week_df)
df = pd.concat(all_dfs)
df.head()
```
%% Output
forecast_date target horizon q0.025 q0.25 q0.5 q0.75 \
0 2021-11-10 DAX 1 day -1.300921 -0.347593 0.064298 0.476189
1 2021-11-10 DAX 2 day -1.254508 -0.271082 0.159424 0.589929
2 2021-11-10 DAX 5 day -1.602475 -0.362460 0.195479 0.753418
3 2021-11-10 DAX 6 day -1.573155 -0.305633 0.269961 0.845555
4 2021-11-10 DAX 7 day -1.548988 -0.186005 0.432461 1.050926
q0.975 name
0 1.429517 AryaStark
1 1.573355 AryaStark
2 1.993433 AryaStark
3 2.113077 AryaStark
4 2.413909 AryaStark
%% Cell type:code id:036da290-43c2-4c46-a881-d10fb75ee734 tags:
``` python
df["95_ci"] = df["q0.975"] - df["q0.025"]
df["50_ci"] = df["q0.75"] - df["q0.25"]
```
%% Cell type:code id:84566cd8-17c0-4171-a823-558f8ef16292 tags:
``` python
df["forecast_date"].unique()
```
%% Output
array(['2021-11-10', '2021-10-27', '2021-10-20', '2021-11-17',
'2021-11-03'], dtype=object)
%% Cell type:code id:eb0112ec-91e6-4a62-a11e-af92f45bde68 tags:
``` python
#plt.figure(figsize=(12,10))
dfg = df.groupby(["forecast_date", "target"]).mean()#.plot(kind="bar")
dfg = dfg.reset_index(level=['target'])
```
%% Cell type:code id:f3c60334-de6d-4e0a-935b-9a419c3ba18b tags:
``` python
plt.figure(figsize=(10,20))
fig, axes = plt.subplots(nrows=1, ncols=3,figsize=(10,3))
dfg[dfg.target == "DAX"][["95_ci", "50_ci"]].plot(kind="bar",
ax=axes[0],
legend=False,
title="DAX")
dfg[dfg.target == "wind"][["95_ci", "50_ci"]].plot(kind="bar",
ax=axes[1],
legend=False,
title="Wind")
dfg[dfg.target == "temperature"][["95_ci", "50_ci"]].plot(kind="bar", ax=axes[2],
title="Temperature")
axes[2].legend(bbox_to_anchor=(1.5, 1))
```
%% Output
<matplotlib.legend.Legend at 0x7f4a71f17bd0>