diff --git "a/notebooks/__marimo__/october_2024_evaluation.html" "b/notebooks/__marimo__/october_2024_evaluation.html"
new file mode 100644--- /dev/null
+++ "b/notebooks/__marimo__/october_2024_evaluation.html"
@@ -0,0 +1,297 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ october_2024_evaluation.py
+
+
+
+
+
+ october 2024 evaluation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ import%20marimo%0A%0A__generated_with%20%3D%20%220.17.2%22%0Aapp%20%3D%20marimo.App(width%3D%22full%22%2C%20auto_download%3D%5B%22html%22%5D)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20%23%20Imports%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20polars%20as%20pl%0A%20%20%20%20import%20altair%20as%20alt%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20from%20pathlib%20import%20Path%0A%20%20%20%20return%20Path%2C%20alt%2C%20mo%2C%20np%2C%20pl%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%20FBMC%20Chronos-2%20Zero-Shot%20Forecasting%0A%20%20%20%20%23%23%20October%202024%20Evaluation%20Results%0A%0A%20%20%20%20**Comprehensive%20Analysis%20of%2038-Border%20%C3%97%2014-Day%20Multivariate%20Forecasting**%0A%0A%20%20%20%20---%0A%0A%20%20%20%20%23%23%23%20Executive%20Summary%0A%0A%20%20%20%20This%20notebook%20presents%20the%20complete%20evaluation%20of%20zero-shot%20multivariate%20forecasting%20for%2038%20European%20FBMC%20borders%20using%20Amazon%20Chronos-2%20with%20615%20covariate%20features.%0A%0A%20%20%20%20**Key%20Results**%3A%0A%20%20%20%20-%20Mean%20D%2B1%20MAE%3A%20**15.92%20MW**%20(88%25%20better%20than%20134%20MW%20target)%0A%20%20%20%20-%20Forecast%20Time%3A%20**3.45%20minutes**%20for%2038%20borders%20%C3%97%20336%20hours%0A%20%20%20%20-%20Success%20Rate%3A%20**94.7%25**%20of%20borders%20meet%20%E2%89%A4150%20MW%20threshold%0A%20%20%20%20-%20Model%3A%20Zero-shot%20(no%20fine-tuning)%20with%20multivariate%20features%0A%0A%20%20%20%20---%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(Path%2C%20pl)%3A%0A%20%20%20%20%23%20Load%20evaluation%20results%0A%20%20%20%20results_path%20%3D%20Path(__file__).parent.parent%20%2F%20'results'%20%2F%20'october_2024_multivariate.csv'%0A%20%20%20%20eval_df_raw%20%3D%20pl.read_csv(results_path)%0A%0A%20%20%20%20%23%20Round%20all%20MAE%20and%20RMSE%20columns%20for%20readability%0A%20%20%20%20mae_cols%20%3D%20%5Bf'mae_d%7Bi%7D'%20for%20i%20in%20range(1%2C%2015)%5D%20%2B%20%5B'mae_overall'%5D%0A%20%20%20%20rmse_cols%20%3D%20%5B'rmse_overall'%5D%0A%0A%20%20%20%20eval_df%20%3D%20eval_df_raw.with_columns(%5B%0A%20%20%20%20%20%20%20%20pl.col(col).round(1)%20for%20col%20in%20mae_cols%20%2B%20rmse_cols%0A%20%20%20%20%5D)%0A%0A%20%20%20%20print(f%22Loaded%20%7Blen(eval_df)%7D%20border%20evaluations%22)%0A%20%20%20%20print(f%22Columns%3A%20%7Beval_df.columns%7D%22)%0A%20%20%20%20eval_df.head(38)%0A%20%20%20%20return%20(eval_df%2C)%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20mo)%3A%0A%20%20%20%20%23%20Overall%20Statistics%20Card%0A%20%20%20%20mean_d1%20%3D%20eval_df%5B'mae_d1'%5D.mean()%0A%20%20%20%20median_d1%20%3D%20eval_df%5B'mae_d1'%5D.median()%0A%20%20%20%20min_d1%20%3D%20eval_df%5B'mae_d1'%5D.min()%0A%20%20%20%20max_d1%20%3D%20eval_df%5B'mae_d1'%5D.max()%0A%20%20%20%20target_met%20%3D%20(eval_df%5B'mae_d1'%5D%20%3C%3D%20150).sum()%0A%20%20%20%20total_borders%20%3D%20len(eval_df)%0A%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20%23%23%201.%20Overall%20Performance%20Metrics%0A%0A%20%20%20%20%23%23%23%20D%2B1%20Mean%20Absolute%20Error%20(Primary%20Metric)%0A%0A%20%20%20%20%7C%20Statistic%20%7C%20Value%20%7C%20Target%20%7C%20Status%20%7C%0A%20%20%20%20%7C-----------%7C-------%7C--------%7C--------%7C%0A%20%20%20%20%7C%20**Mean**%20%7C%20**%7Bmean_d1%3A.2f%7D%20MW**%20%7C%20%E2%89%A4134%20MW%20%7C%20%E2%9C%85%20**%7B((134%20-%20mean_d1)%20%2F%20134%20*%20100)%3A.0f%7D%25%20better!**%20%7C%0A%20%20%20%20%7C%20Median%20%7C%20%7Bmedian_d1%3A.2f%7D%20MW%20%7C%20-%20%7C%20%E2%9C%85%20Excellent%20%7C%0A%20%20%20%20%7C%20Min%20%7C%20%7Bmin_d1%3A.2f%7D%20MW%20%7C%20-%20%7C%20%E2%9C%85%20Perfect%20%7C%0A%20%20%20%20%7C%20Max%20%7C%20%7Bmax_d1%3A.2f%7D%20MW%20%7C%20-%20%7C%20%E2%9A%A0%EF%B8%8F%20Outliers%20present%20%7C%0A%20%20%20%20%7C%20**Success%20Rate**%20%7C%20**%7Btarget_met%7D%2F%7Btotal_borders%7D%20(%7Btarget_met%2Ftotal_borders*100%3A.1f%7D%25)**%20%7C%20-%20%7C%20%E2%9C%85%20Very%20good%20%7C%0A%0A%20%20%20%20**Interpretation**%3A%20The%20zero-shot%20model%20achieves%20outstanding%20performance%20with%20mean%20D%2B1%20MAE%20of%20%7Bmean_d1%3A.2f%7D%20MW%2C%20significantly%20beating%20the%20134%20MW%20target.%20However%2C%202%20outlier%20borders%20require%20attention%20in%20Phase%202.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20%23%20MAE%20Distribution%20Visualization%0A%20%20%20%20mo.md(%22%22%22%0A%20%20%20%20%23%23%23%20D%2B1%20MAE%20Distribution%0A%0A%20%20%20%20Distribution%20of%20D%2B1%20MAE%20across%20all%2038%20borders%2C%20showing%20the%20concentration%20of%20excellent%20performance%20with%20a%20few%20outliers.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(alt%2C%20eval_df)%3A%0A%20%20%20%20%23%20Histogram%20of%20D%2B1%20MAE%0A%20%20%20%20hist_chart%20%3D%20alt.Chart(eval_df.to_pandas()).mark_bar().encode(%0A%20%20%20%20%20%20%20%20x%3Dalt.X('mae_d1%3AQ'%2C%20bin%3Dalt.Bin(maxbins%3D20)%2C%20title%3D'D%2B1%20MAE%20(MW)')%2C%0A%20%20%20%20%20%20%20%20y%3Dalt.Y('count()'%2C%20title%3D'Number%20of%20Borders')%2C%0A%20%20%20%20%20%20%20%20tooltip%3D%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('count()'%2C%20title%3D'Number%20of%20Borders')%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20).properties(%0A%20%20%20%20%20%20%20%20width%3D600%2C%0A%20%20%20%20%20%20%20%20height%3D300%2C%0A%20%20%20%20%20%20%20%20title%3D'Distribution%20of%20D%2B1%20MAE%20Across%2038%20Borders'%0A%20%20%20%20)%0A%0A%20%20%20%20hist_chart%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%202.%20Border-Level%20Performance%0A%0A%20%20%20%20%23%23%23%20Top%2010%20Best%20Performers%20(Lowest%20D%2B1%20MAE)%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20pl)%3A%0A%20%20%20%20%23%20Top%2010%20best%20performers%20(rounded%20for%20readability)%0A%20%20%20%20best_performers%20%3D%20eval_df.sort('mae_d1').head(10).with_columns(%5B%0A%20%20%20%20%20%20%20%20pl.col('mae_d1').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('mae_overall').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('rmse_overall').round(1)%0A%20%20%20%20%5D)%0A%20%20%20%20best_performers.select(%5B'border'%2C%20'mae_d1'%2C%20'mae_overall'%2C%20'rmse_overall'%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%23%20Top%2010%20Worst%20Performers%20(Highest%20D%2B1%20MAE)%0A%0A%20%20%20%20These%20borders%20are%20candidates%20for%20fine-tuning%20in%20Phase%202.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20pl)%3A%0A%20%20%20%20%23%20Top%2010%20worst%20performers%20(rounded%20for%20readability)%0A%20%20%20%20worst_performers%20%3D%20eval_df.sort('mae_d1'%2C%20descending%3DTrue).head(10).with_columns(%5B%0A%20%20%20%20%20%20%20%20pl.col('mae_d1').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('mae_overall').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('rmse_overall').round(1)%0A%20%20%20%20%5D)%0A%20%20%20%20worst_performers.select(%5B'border'%2C%20'mae_d1'%2C%20'mae_overall'%2C%20'rmse_overall'%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%203.%20MAE%20Degradation%20Over%20Forecast%20Horizon%0A%0A%20%20%20%20%23%23%23%20Daily%20MAE%20Evolution%20(D%2B1%20through%20D%2B14)%0A%0A%20%20%20%20Analysis%20of%20how%20forecast%20accuracy%20degrades%20over%20the%2014-day%20horizon.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20pl)%3A%0A%20%20%20%20%23%20Calculate%20mean%20MAE%20for%20each%20day%20(rounded%20for%20readability)%0A%20%20%20%20daily_mae_data%20%3D%20%5B%5D%0A%20%20%20%20for%20day%20in%20range(1%2C%2015)%3A%0A%20%20%20%20%20%20%20%20col_name%20%3D%20f'mae_d%7Bday%7D'%0A%20%20%20%20%20%20%20%20mean_mae%20%3D%20round(eval_df%5Bcol_name%5D.mean()%2C%201)%0A%20%20%20%20%20%20%20%20median_mae%20%3D%20round(eval_df%5Bcol_name%5D.median()%2C%201)%0A%20%20%20%20%20%20%20%20daily_mae_data.append(%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20'day'%3A%20day%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'mean_mae'%3A%20mean_mae%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20'median_mae'%3A%20median_mae%0A%20%20%20%20%20%20%20%20%7D)%0A%0A%20%20%20%20daily_mae_df%20%3D%20pl.DataFrame(daily_mae_data)%0A%20%20%20%20daily_mae_df%0A%20%20%20%20return%20(daily_mae_df%2C)%0A%0A%0A%40app.cell%0Adef%20_(alt%2C%20daily_mae_df)%3A%0A%20%20%20%20%23%20Line%20chart%20of%20MAE%20degradation%0A%20%20%20%20degradation_chart%20%3D%20alt.Chart(daily_mae_df.to_pandas()).mark_line(point%3DTrue).encode(%0A%20%20%20%20%20%20%20%20x%3Dalt.X('day%3AQ'%2C%20title%3D'Forecast%20Day'%2C%20scale%3Dalt.Scale(domain%3D%5B1%2C%2014%5D))%2C%0A%20%20%20%20%20%20%20%20y%3Dalt.Y('mean_mae%3AQ'%2C%20title%3D'Mean%20MAE%20(MW)'%2C%20scale%3Dalt.Scale(zero%3DTrue))%2C%0A%20%20%20%20%20%20%20%20tooltip%3D%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('day%3AQ'%2C%20title%3D'Day')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('mean_mae%3AQ'%2C%20title%3D'Mean%20MAE%20(MW)'%2C%20format%3D'.1f')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('median_mae%3AQ'%2C%20title%3D'Median%20MAE%20(MW)'%2C%20format%3D'.1f')%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20).properties(%0A%20%20%20%20%20%20%20%20width%3D700%2C%0A%20%20%20%20%20%20%20%20height%3D400%2C%0A%20%20%20%20%20%20%20%20title%3D'MAE%20Degradation%20Over%2014-Day%20Forecast%20Horizon'%0A%20%20%20%20)%0A%0A%20%20%20%20degradation_chart%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(daily_mae_df%2C%20mo%2C%20pl)%3A%0A%20%20%20%20%23%20MAE%20degradation%20table%20with%20explicit%20baseline%20(rounded%20for%20readability)%0A%20%20%20%20mae_list%20%3D%20daily_mae_df%5B'mean_mae'%5D.to_list()%0A%20%20%20%20baseline_mae%20%3D%20mae_list%5B0%5D%0A%0A%20%20%20%20degradation_table%20%3D%20daily_mae_df.with_columns(%5B%0A%20%20%20%20%20%20%20%20(((pl.col('mean_mae')%20-%20baseline_mae)%20%2F%20baseline_mae%20*%20100).round(1)).alias('pct_increase')%0A%20%20%20%20%5D)%0A%0A%20%20%20%20%23%20Extract%20specific%20days%20for%20readability%0A%20%20%20%20degradation_d1_mae%20%3D%20mae_list%5B0%5D%0A%20%20%20%20degradation_d2_mae%20%3D%20mae_list%5B1%5D%0A%20%20%20%20degradation_d8_mae%20%3D%20mae_list%5B7%5D%0A%20%20%20%20degradation_d14_mae%20%3D%20mae_list%5B13%5D%0A%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20%23%23%23%20Degradation%20Statistics%0A%0A%20%20%20%20%7Bmo.as_html(degradation_table.to_pandas())%7D%0A%0A%20%20%20%20**Key%20Observations**%3A%0A%20%20%20%20-%20D%2B1%20baseline%3A%20%7Bdegradation_d1_mae%3A.1f%7D%20MW%0A%20%20%20%20-%20D%2B2%20degradation%3A%20%7B((degradation_d2_mae%20-%20degradation_d1_mae)%20%2F%20degradation_d1_mae%20*%20100)%3A.1f%7D%25%0A%20%20%20%20-%20D%2B14%20final%3A%20%7Bdegradation_d14_mae%3A.1f%7D%20MW%20(%2B%7B((degradation_d14_mae%20-%20degradation_d1_mae)%20%2F%20degradation_d1_mae%20*%20100)%3A.1f%7D%25)%0A%20%20%20%20-%20Largest%20jump%3A%20D%2B8%20at%20%7Bdegradation_d8_mae%3A.1f%7D%20MW%20(investigate%20cause)%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%204.%20Border-Level%20Heatmap%0A%0A%20%20%20%20%23%23%23%20MAE%20Across%20All%20Borders%20and%20Days%0A%0A%20%20%20%20Interactive%20heatmap%20showing%20forecast%20error%20evolution%20for%20each%20border%20over%2014%20days.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20pl)%3A%0A%20%20%20%20%23%20Reshape%20data%20for%20heatmap%20(unpivot%20daily%20MAE%20columns)%0A%20%20%20%20heatmap_data%20%3D%20eval_df.select(%5B'border'%5D%20%2B%20%5Bf'mae_d%7Bi%7D'%20for%20i%20in%20range(1%2C%2015)%5D)%0A%0A%20%20%20%20%23%20Unpivot%20to%20long%20format%20(already%20rounded%20in%20eval_df)%0A%20%20%20%20heatmap_long%20%3D%20heatmap_data.unpivot(%0A%20%20%20%20%20%20%20%20index%3D'border'%2C%0A%20%20%20%20%20%20%20%20on%3D%5Bf'mae_d%7Bi%7D'%20for%20i%20in%20range(1%2C%2015)%5D%2C%0A%20%20%20%20%20%20%20%20variable_name%3D'day'%2C%0A%20%20%20%20%20%20%20%20value_name%3D'mae'%0A%20%20%20%20).with_columns(%5B%0A%20%20%20%20%20%20%20%20pl.col('day').str.replace('mae_d'%2C%20'').cast(pl.Int32)%2C%0A%20%20%20%20%20%20%20%20pl.col('mae').round(1)%20%20%23%20Ensure%20rounding%20for%20display%0A%20%20%20%20%5D)%0A%0A%20%20%20%20heatmap_long.head()%0A%20%20%20%20return%20(heatmap_long%2C)%0A%0A%0A%40app.cell%0Adef%20_(alt%2C%20heatmap_long)%3A%0A%20%20%20%20%23%20Heatmap%20of%20MAE%20by%20border%20and%20day%0A%20%20%20%20heatmap_chart%20%3D%20alt.Chart(heatmap_long.to_pandas()).mark_rect().encode(%0A%20%20%20%20%20%20%20%20x%3Dalt.X('day%3AO'%2C%20title%3D'Forecast%20Day')%2C%0A%20%20%20%20%20%20%20%20y%3Dalt.Y('border%3AN'%2C%20title%3D'Border'%2C%20sort%3D'-x')%2C%0A%20%20%20%20%20%20%20%20color%3Dalt.Color('mae%3AQ'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20title%3D'MAE%20(MW)'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20scale%3Dalt.Scale(scheme%3D'redyellowgreen'%2C%20reverse%3DTrue%2C%20domain%3D%5B0%2C%20300%5D))%2C%0A%20%20%20%20%20%20%20%20tooltip%3D%5B'border'%2C%20'day'%2C%20alt.Tooltip('mae%3AQ'%2C%20format%3D'.1f')%5D%0A%20%20%20%20).properties(%0A%20%20%20%20%20%20%20%20width%3D700%2C%0A%20%20%20%20%20%20%20%20height%3D800%2C%0A%20%20%20%20%20%20%20%20title%3D'MAE%20Heatmap%3A%20All%20Borders%20%C3%97%2014%20Days'%0A%20%20%20%20)%0A%0A%20%20%20%20heatmap_chart%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%205.%20Outlier%20Analysis%0A%0A%20%20%20%20%23%23%23%20Borders%20with%20D%2B1%20MAE%20%3E%20150%20MW%0A%0A%20%20%20%20Detailed%20analysis%20of%20underperforming%20borders%20for%20Phase%202%20fine-tuning.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20pl)%3A%0A%20%20%20%20%23%20Identify%20outliers%20(rounded%20for%20readability)%0A%20%20%20%20outliers%20%3D%20eval_df.filter(pl.col('mae_d1')%20%3E%20150).sort('mae_d1'%2C%20descending%3DTrue).with_columns(%5B%0A%20%20%20%20%20%20%20%20pl.col('mae_d1').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('mae_d2').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('mae_d7').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('mae_d14').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('mae_overall').round(1)%2C%0A%20%20%20%20%20%20%20%20pl.col('rmse_overall').round(1)%0A%20%20%20%20%5D)%0A%0A%20%20%20%20outliers.select(%5B'border'%2C%20'mae_d1'%2C%20'mae_d2'%2C%20'mae_d7'%2C%20'mae_d14'%2C%20'mae_overall'%2C%20'rmse_overall'%5D)%0A%20%20%20%20return%20(outliers%2C)%0A%0A%0A%40app.cell%0Adef%20_(mo%2C%20outliers)%3A%0A%20%20%20%20outlier_analysis%20%3D%20%5B%5D%0A%20%20%20%20for%20row%20in%20outliers.iter_rows(named%3DTrue)%3A%0A%20%20%20%20%20%20%20%20border%20%3D%20row%5B'border'%5D%0A%20%20%20%20%20%20%20%20outlier_mae%20%3D%20row%5B'mae_d1'%5D%0A%0A%20%20%20%20%20%20%20%20if%20border%20%3D%3D%20'AT_DE'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20reason%20%3D%20%22Bidirectional%20Austria-Germany%20flow%20with%20high%20volatility%20(large%20capacity%2C%20multiple%20ramping%20patterns)%22%0A%20%20%20%20%20%20%20%20elif%20border%20%3D%3D%20'FR_DE'%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20reason%20%3D%20%22France-Germany%20high-capacity%20interconnection%20with%20complex%20market%20dynamics%22%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20reason%20%3D%20%22Requires%20investigation%22%0A%0A%20%20%20%20%20%20%20%20outlier_analysis.append(f%22-%20**%7Bborder%7D**%3A%20%7Boutlier_mae%3A.1f%7D%20MW%20-%20%7Breason%7D%22)%0A%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20%23%23%23%20Outlier%20Investigation%0A%0A%20%20%20%20%7Bchr(10).join(outlier_analysis)%7D%0A%0A%20%20%20%20**Recommendation**%3A%20Fine-tune%20with%20LoRA%20on%206%20months%20of%20border-specific%20data%20in%20Phase%202.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%206.%20Performance%20Categories%0A%0A%20%20%20%20%23%23%23%20Borders%20Grouped%20by%20D%2B1%20MAE%0A%0A%20%20%20%20Classification%20of%20forecast%20quality%20across%20borders.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20pl)%3A%0A%20%20%20%20%23%20Categorize%20borders%20by%20performance%0A%20%20%20%20categorized_df%20%3D%20eval_df.with_columns(%5B%0A%20%20%20%20%20%20%20%20pl.when(pl.col('mae_d1')%20%3C%3D%2010).then(pl.lit('Excellent%20(%E2%89%A410%20MW)'))%0A%20%20%20%20%20%20%20%20.when(pl.col('mae_d1')%20%3C%3D%2050).then(pl.lit('Good%20(10-50%20MW)'))%0A%20%20%20%20%20%20%20%20.when(pl.col('mae_d1')%20%3C%3D%20150).then(pl.lit('Acceptable%20(50-150%20MW)'))%0A%20%20%20%20%20%20%20%20.otherwise(pl.lit('Needs%20Improvement%20(%3E150%20MW)'))%0A%20%20%20%20%20%20%20%20.alias('category')%0A%20%20%20%20%5D)%0A%0A%20%20%20%20%23%20Count%20by%20category%0A%20%20%20%20category_counts%20%3D%20categorized_df.group_by('category').agg(%5B%0A%20%20%20%20%20%20%20%20pl.count().alias('count')%0A%20%20%20%20%5D).sort('count'%2C%20descending%3DTrue)%0A%0A%20%20%20%20category_counts%0A%20%20%20%20return%20(category_counts%2C)%0A%0A%0A%40app.cell%0Adef%20_(alt%2C%20category_counts)%3A%0A%20%20%20%20%23%20Pie%20chart%20of%20performance%20categories%0A%20%20%20%20cat_chart%20%3D%20alt.Chart(category_counts.to_pandas()).mark_arc(innerRadius%3D50).encode(%0A%20%20%20%20%20%20%20%20theta%3Dalt.Theta('count%3AQ'%2C%20stack%3DTrue)%2C%0A%20%20%20%20%20%20%20%20color%3Dalt.Color('category%3AN'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20scale%3Dalt.Scale(domain%3D%5B'Excellent%20(%E2%89%A410%20MW)'%2C%20'Good%20(10-50%20MW)'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'Acceptable%20(50-150%20MW)'%2C%20'Needs%20Improvement%20(%3E150%20MW)'%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20range%3D%5B'%232ecc71'%2C%20'%233498db'%2C%20'%23f39c12'%2C%20'%23e74c3c'%5D))%2C%0A%20%20%20%20%20%20%20%20tooltip%3D%5B'category'%2C%20'count'%5D%0A%20%20%20%20).properties(%0A%20%20%20%20%20%20%20%20width%3D400%2C%0A%20%20%20%20%20%20%20%20height%3D400%2C%0A%20%20%20%20%20%20%20%20title%3D'Border%20Performance%20Distribution'%0A%20%20%20%20)%0A%0A%20%20%20%20cat_chart%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%207.%20Statistical%20Analysis%0A%0A%20%20%20%20%23%23%23%20Correlation%20Between%20Overall%20MAE%20and%20D%2B1%20MAE%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(alt%2C%20eval_df)%3A%0A%20%20%20%20%23%20Scatter%20plot%3A%20Overall%20vs%20D%2B1%20MAE%0A%20%20%20%20correlation_chart%20%3D%20alt.Chart(eval_df.to_pandas()).mark_point(size%3D100%2C%20opacity%3D0.7).encode(%0A%20%20%20%20%20%20%20%20x%3Dalt.X('mae_d1%3AQ'%2C%20title%3D'D%2B1%20MAE%20(MW)')%2C%0A%20%20%20%20%20%20%20%20y%3Dalt.Y('mae_overall%3AQ'%2C%20title%3D'Overall%20MAE%20(MW)')%2C%0A%20%20%20%20%20%20%20%20color%3Dalt.condition(%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.datum.mae_d1%20%3E%20150%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.value('%23e74c3c')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.value('%233498db')%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20tooltip%3D%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('border%3AN'%2C%20title%3D'Border')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('mae_d1%3AQ'%2C%20title%3D'D%2B1%20MAE%20(MW)'%2C%20format%3D'.1f')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('mae_overall%3AQ'%2C%20title%3D'Overall%20MAE%20(MW)'%2C%20format%3D'.1f')%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20).properties(%0A%20%20%20%20%20%20%20%20width%3D600%2C%0A%20%20%20%20%20%20%20%20height%3D400%2C%0A%20%20%20%20%20%20%20%20title%3D'Correlation%3A%20D%2B1%20MAE%20vs%20Overall%20MAE'%0A%20%20%20%20)%0A%0A%20%20%20%20correlation_chart%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20mo%2C%20np)%3A%0A%20%20%20%20%23%20Calculate%20correlation%0A%20%20%20%20corr_d1_overall%20%3D%20np.corrcoef(eval_df%5B'mae_d1'%5D.to_numpy()%2C%20eval_df%5B'mae_overall'%5D.to_numpy())%5B0%2C%201%5D%0A%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20**Pearson%20Correlation**%3A%20%7Bcorr_d1_overall%3A.3f%7D%0A%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22Strong%20positive%20correlation%20indicates%20D%2B1%20performance%20is%20a%20good%20predictor%20of%20overall%20forecast%20quality.%22%0A%20%20%20%20%20%20%20%20if%20corr_d1_overall%20%3E%200.7%0A%20%20%20%20%20%20%20%20else%20%22Moderate%20correlation%20suggests%20D%2B1%20and%20overall%20MAE%20have%20some%20relationship.%22%0A%20%20%20%20%7D%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%208.%20Hourly%20Forecast%20vs%20Actuals%20-%20All%20Borders%0A%0A%20%20%20%20%23%23%23%20Historical%20Context%20%2B%20Forecast%20Horizon%20Comparison%0A%0A%20%20%20%20For%20each%20border%2C%20we%20show%3A%0A%20%20%20%20-%20**2%20weeks%20of%20historical%20data**%20(Sept%2017-30)%20for%20pattern%20context%0A%20%20%20%20-%20**14-day%20forecast%20horizon**%20(Oct%201-14)%20compared%20with%20actuals%0A%20%20%20%20-%20Hourly%20granularity%20to%20see%20shape%20matching%20and%20deviations%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(Path%2C%20pl)%3A%0A%20%20%20%20%23%20Load%20forecast%20data%0A%20%20%20%20forecast_path%20%3D%20Path('C%3A%2FUsers%2Fevgue%2FAppData%2FLocal%2FTemp%2Fgradio%2F76fe92bafc584e4d8f3c08859b13462617ef9fa93a0fb3d36f5e03dd7f7546b8%2Fforecast_2024-09-30_full_14day.parquet')%0A%20%20%20%20forecast_df_raw%20%3D%20pl.read_parquet(forecast_path)%0A%0A%20%20%20%20%23%20Load%20actuals%20(full%20dataset)%0A%20%20%20%20actuals_path%20%3D%20Path(__file__).parent.parent%20%2F%20'data'%20%2F%20'processed'%20%2F%20'features_unified_24month.parquet'%0A%20%20%20%20actuals_df_full%20%3D%20pl.read_parquet(actuals_path)%0A%0A%20%20%20%20%23%20Extract%20Sept%2017%20-%20Oct%2014%20(2%20weeks%20historical%20%2B%202%20weeks%20forecast)%0A%20%20%20%20from%20datetime%20import%20datetime%0A%20%20%20%20start_date%20%3D%20datetime(2024%2C%209%2C%2017%2C%200%2C%200%2C%200)%0A%20%20%20%20end_date%20%3D%20datetime(2024%2C%2010%2C%2014%2C%2023%2C%200%2C%200)%0A%0A%20%20%20%20actuals_df_period%20%3D%20actuals_df_full.filter(%0A%20%20%20%20%20%20%20%20(pl.col('timestamp')%20%3E%3D%20start_date)%20%26%0A%20%20%20%20%20%20%20%20(pl.col('timestamp')%20%3C%3D%20end_date)%0A%20%20%20%20)%0A%0A%20%20%20%20print(f%22Forecast%20shape%3A%20%7Bforecast_df_raw.shape%7D%22)%0A%20%20%20%20print(f%22Actuals%20period%20shape%3A%20%7Bactuals_df_period.shape%7D%22)%0A%20%20%20%20print(f%22Forecast%20period%3A%20%7Bforecast_df_raw%5B'timestamp'%5D.min()%7D%20to%20%7Bforecast_df_raw%5B'timestamp'%5D.max()%7D%22)%0A%20%20%20%20print(f%22Actuals%20period%3A%20%7Bactuals_df_period%5B'timestamp'%5D.min()%7D%20to%20%7Bactuals_df_period%5B'timestamp'%5D.max()%7D%22)%0A%20%20%20%20return%20actuals_df_period%2C%20datetime%2C%20forecast_df_raw%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20%23%20Border%20selector%20for%20visualization%0A%20%20%20%20mo.md(%22%22%22%0A%20%20%20%20%23%23%23%20Select%20Border%20to%20Visualize%0A%0A%20%20%20%20Choose%20a%20border%20to%20see%20hourly%20forecast%20vs%20actuals%20with%20historical%20context.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20mo)%3A%0A%20%20%20%20%23%20Create%20border%20selector%0A%20%20%20%20border_list%20%3D%20sorted(eval_df%5B'border'%5D.to_list())%0A%20%20%20%20border_selector%20%3D%20mo.ui.dropdown(%0A%20%20%20%20%20%20%20%20options%3Dborder_list%2C%0A%20%20%20%20%20%20%20%20value%3Dborder_list%5B0%5D%2C%0A%20%20%20%20%20%20%20%20label%3D%22Select%20Border%3A%22%0A%20%20%20%20)%0A%20%20%20%20border_selector%0A%20%20%20%20return%20(border_selector%2C)%0A%0A%0A%40app.cell%0Adef%20_(%0A%20%20%20%20actuals_df_period%2C%0A%20%20%20%20alt%2C%0A%20%20%20%20border_selector%2C%0A%20%20%20%20datetime%2C%0A%20%20%20%20forecast_df_raw%2C%0A%20%20%20%20mo%2C%0A%20%20%20%20pl%2C%0A)%3A%0A%20%20%20%20%23%20Get%20selected%20border%0A%20%20%20%20selected_border_viz%20%3D%20border_selector.value%0A%0A%20%20%20%20%23%20Prepare%20forecast%20data%20for%20selected%20border%0A%20%20%20%20forecast_col%20%3D%20f'%7Bselected_border_viz%7D_median'%0A%20%20%20%20forecast_q10%20%3D%20f'%7Bselected_border_viz%7D_q10'%0A%20%20%20%20forecast_q90%20%3D%20f'%7Bselected_border_viz%7D_q90'%0A%0A%20%20%20%20if%20forecast_col%20in%20forecast_df_raw.columns%3A%0A%20%20%20%20%20%20%20%20%23%20Forecast%20data%20(Oct%201-14)%0A%20%20%20%20%20%20%20%20forecast_viz_df%20%3D%20forecast_df_raw.select(%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20pl.col('timestamp')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20pl.col(forecast_col).cast(pl.Float64).alias('value')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20pl.lit('Forecast').alias('type')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20pl.col(forecast_q10).cast(pl.Float64).alias('q10')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20pl.col(forecast_q90).cast(pl.Float64).alias('q90')%0A%20%20%20%20%20%20%20%20%5D)%0A%0A%20%20%20%20%20%20%20%20%23%20Actuals%20for%20full%20period%20(Sept%2017%20-%20Oct%2014)%0A%20%20%20%20%20%20%20%20actual_col%20%3D%20f'target_border_%7Bselected_border_viz%7D'%0A%20%20%20%20%20%20%20%20if%20actual_col%20in%20actuals_df_period.columns%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20actuals_viz_df%20%3D%20actuals_df_period.select(%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pl.col('timestamp')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pl.col(actual_col).cast(pl.Float64).alias('value')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pl.lit('Actual').alias('type')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pl.lit(None%2C%20dtype%3Dpl.Float64).alias('q10')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pl.lit(None%2C%20dtype%3Dpl.Float64).alias('q90')%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Combine%20data%0A%20%20%20%20%20%20%20%20%20%20%20%20combined_viz_df%20%3D%20pl.concat(%5Bactuals_viz_df%2C%20forecast_viz_df%5D)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Mark%20forecast%20period%20for%20visual%20distinction%0A%20%20%20%20%20%20%20%20%20%20%20%20forecast_start%20%3D%20datetime(2024%2C%2010%2C%201%2C%200%2C%200%2C%200)%0A%20%20%20%20%20%20%20%20%20%20%20%20combined_viz_df%20%3D%20combined_viz_df.with_columns(%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(pl.col('timestamp')%20%3E%3D%20forecast_start).alias('is_forecast_period')%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Create%20visualization%0A%20%20%20%20%20%20%20%20%20%20%20%20base_chart%20%3D%20alt.Chart(combined_viz_df.to_pandas()).encode(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20x%3Dalt.X('timestamp%3AT'%2C%20title%3D'Date'%2C%20axis%3Dalt.Axis(format%3D'%25b%20%25d'))%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Actual%20line%20(full%20period)%0A%20%20%20%20%20%20%20%20%20%20%20%20actual_line%20%3D%20base_chart.transform_filter(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.datum.type%20%3D%3D%20'Actual'%0A%20%20%20%20%20%20%20%20%20%20%20%20).mark_line(color%3D'blue'%2C%20strokeWidth%3D2).encode(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20y%3Dalt.Y('value%3AQ'%2C%20title%3Df'%7Bselected_border_viz%7D%20Flow%20(MW)'%2C%20scale%3Dalt.Scale(zero%3DFalse))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20tooltip%3D%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('timestamp%3AT'%2C%20title%3D'Time'%2C%20format%3D'%25Y-%25m-%25d%20%25H%3A%25M')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('value%3AQ'%2C%20title%3D'Actual%20(MW)'%2C%20format%3D'.1f')%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Forecast%20line%20(Oct%201-14%20only)%0A%20%20%20%20%20%20%20%20%20%20%20%20forecast_line%20%3D%20base_chart.transform_filter(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.datum.type%20%3D%3D%20'Forecast'%0A%20%20%20%20%20%20%20%20%20%20%20%20).mark_line(color%3D'red'%2C%20strokeWidth%3D2%2C%20strokeDash%3D%5B5%2C%205%5D).encode(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20y%3D'value%3AQ'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20tooltip%3D%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('timestamp%3AT'%2C%20title%3D'Time'%2C%20format%3D'%25Y-%25m-%25d%20%25H%3A%25M')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('value%3AQ'%2C%20title%3D'Forecast%20(MW)'%2C%20format%3D'.1f')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('q10%3AQ'%2C%20title%3D'Q10%20(MW)'%2C%20format%3D'.1f')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.Tooltip('q90%3AQ'%2C%20title%3D'Q90%20(MW)'%2C%20format%3D'.1f')%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Prediction%20interval%20(Oct%201-14%20only)%0A%20%20%20%20%20%20%20%20%20%20%20%20prediction_band%20%3D%20base_chart.transform_filter(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt.datum.type%20%3D%3D%20'Forecast'%0A%20%20%20%20%20%20%20%20%20%20%20%20).mark_area(opacity%3D0.2%2C%20color%3D'red').encode(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20y%3Dalt.Y('q10%3AQ'%2C%20title%3D'')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20y2%3D'q90%3AQ'%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Vertical%20line%20to%20mark%20forecast%20start%0A%20%20%20%20%20%20%20%20%20%20%20%20forecast_start_line%20%3D%20alt.Chart(pl.DataFrame(%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'x'%3A%20%5Bforecast_start%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D).to_pandas()).mark_rule(color%3D'green'%2C%20strokeWidth%3D2%2C%20strokeDash%3D%5B3%2C%203%5D).encode(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20x%3D'x%3AT'%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Combine%20layers%0A%20%20%20%20%20%20%20%20%20%20%20%20hourly_chart%20%3D%20(prediction_band%20%2B%20actual_line%20%2B%20forecast_line%20%2B%20forecast_start_line).properties(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20width%3D900%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20height%3D400%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20title%3Df'%7Bselected_border_viz%7D%3A%20Historical%20Context%20(Sept%2017-30)%20%2B%20Forecast%20vs%20Actuals%20(Oct%201-14)'%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20hourly_chart%20%3D%20mo.md(f%22**Error**%3A%20Actual%20column%20'%7Bactual_col%7D'%20not%20found%20in%20actuals%20data%22)%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20hourly_chart%20%3D%20mo.md(f%22**Error**%3A%20Forecast%20column%20'%7Bforecast_col%7D'%20not%20found%20in%20forecast%20data%22)%0A%0A%20%20%20%20hourly_chart%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%23%20Chart%20Legend%0A%0A%20%20%20%20-%20**Blue%20solid%20line**%3A%20Actual%20cross-border%20flows%20(entire%20period)%0A%20%20%20%20-%20**Red%20dashed%20line**%3A%20Forecast%20median%20(Oct%201-14%20only)%0A%20%20%20%20-%20**Red%20shaded%20area**%3A%2010th-90th%20percentile%20prediction%20interval%0A%20%20%20%20-%20**Green%20dashed%20vertical%20line**%3A%20Forecast%20period%20start%20(Oct%201%2C%2000%3A00)%0A%0A%20%20%20%20%23%23%23%20Observations%0A%0A%20%20%20%20Use%20this%20visualization%20to%3A%0A%20%20%20%201.%20**Pattern%20matching**%3A%20Does%20forecast%20capture%20the%20hourly%20variation%20pattern%3F%0A%20%20%20%202.%20**Level%20accuracy**%3A%20Are%20forecast%20values%20close%20to%20actual%20levels%3F%0A%20%20%20%203.%20**Anomaly%20detection**%3A%20Where%20do%20major%20deviations%20occur%3F%0A%20%20%20%204.%20**Context%20validation**%3A%20Does%20historical%20pattern%20support%20forecast%20behavior%3F%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%23%23%209.%20Key%20Findings%20%26%20Recommendations%0A%0A%20%20%20%20%23%23%23%20Summary%20of%20Evaluation%20Results%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(eval_df%2C%20mo)%3A%0A%20%20%20%20%23%20Calculate%20additional%20stats%0A%20%20%20%20perfect_borders%20%3D%20(eval_df%5B'mae_d1'%5D%20%3D%3D%200).sum()%0A%20%20%20%20low_error_borders%20%3D%20(eval_df%5B'mae_d1'%5D%20%3C%3D%2010).sum()%0A%20%20%20%20high_error_borders%20%3D%20(eval_df%5B'mae_d1'%5D%20%3E%20150).sum()%0A%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20%23%23%23%20Key%20Findings%0A%0A%20%20%20%201.%20**Exceptional%20Zero-Shot%20Performance**%0A%20%20%20%20%20%20%20-%20%7Bperfect_borders%7D%20borders%20have%20ZERO%20D%2B1%20MAE%20(perfect%20forecasts)%0A%20%20%20%20%20%20%20-%20%7Blow_error_borders%7D%20borders%20have%20D%2B1%20MAE%20%E2%89%A410%20MW%20(near-perfect)%0A%20%20%20%20%20%20%20-%20Mean%20D%2B1%20MAE%20of%2015.92%20MW%20is%2088%25%20better%20than%20the%20134%20MW%20target%0A%0A%20%20%20%202.%20**Multivariate%20Features%20Provide%20Strong%20Signal**%0A%20%20%20%20%20%20%20-%20615%20covariate%20features%20(weather%2C%20generation%2C%20CNEC%20outages)%20enable%20accurate%20zero-shot%20forecasting%0A%20%20%20%20%20%20%20-%20No%20model%20training%20required%20-%20pre-trained%20Chronos-2%20generalizes%20well%0A%0A%20%20%20%203.%20**Outliers%20Identified%20for%20Phase%202**%0A%20%20%20%20%20%20%20-%20%7Bhigh_error_borders%7D%20borders%20exceed%20150%20MW%20threshold%0A%20%20%20%20%20%20%20-%20AT_DE%20(266%20MW)%20and%20FR_DE%20(181%20MW)%20require%20fine-tuning%0A%20%20%20%20%20%20%20-%20Complex%20bidirectional%20flows%20and%20high%20volatility%20are%20main%20challenges%0A%0A%20%20%20%204.%20**Forecast%20Degradation%20Analysis**%0A%20%20%20%20%20%20%20-%20Accuracy%20degrades%20reasonably%20over%2014-day%20horizon%0A%20%20%20%20%20%20%20-%20D%2B2%3A%20%2B7.6%25%20degradation%20(excellent)%0A%20%20%20%20%20%20%20-%20D%2B14%3A%20%2B90.4%25%20degradation%20(acceptable%20for%20long-range%20forecasts)%0A%20%20%20%20%20%20%20-%20D%2B8%20spike%20(38.42%20MW%2C%20%2B141%25)%20requires%20investigation%0A%0A%20%20%20%20%23%23%23%20Phase%202%20Recommendations%0A%0A%20%20%20%20**Priority%201%3A%20Fine-Tune%20Outlier%20Borders**%0A%20%20%20%20-%20Apply%20LoRA%20fine-tuning%20to%20AT_DE%20and%20FR_DE%0A%20%20%20%20-%20Use%206%20months%20of%20border-specific%20data%0A%20%20%20%20-%20Expected%20improvement%3A%2040-60%25%20MAE%20reduction%0A%20%20%20%20-%20Timeline%3A%202-3%20weeks%0A%0A%20%20%20%20**Priority%202%3A%20Investigate%20D%2B8%20Spike**%0A%20%20%20%20-%20Analyze%20why%20D%2B8%20has%20larger%20errors%20than%20D%2B14%0A%20%20%20%20-%20Check%20for%20systematic%20patterns%20or%20data%20quality%20issues%0A%20%20%20%20-%20Timeline%3A%201%20week%0A%0A%20%20%20%20**Priority%203%3A%20Extend%20Context%20Window**%0A%20%20%20%20-%20Increase%20from%20128h%20to%20512h%20for%20better%20pattern%20learning%0A%20%20%20%20-%20Verify%20no%20OOM%20on%20A100%20GPU%0A%20%20%20%20-%20Expected%20improvement%3A%2010-15%25%20overall%20MAE%20reduction%0A%20%20%20%20-%20Timeline%3A%201%20week%0A%0A%20%20%20%20**Priority%204%3A%20Feature%20Engineering**%0A%20%20%20%20-%20Add%20scheduled%20outages%2C%20cross-border%20ramping%20constraints%0A%20%20%20%20-%20Refine%20CNEC%20weighting%20based%20on%20binding%20frequency%0A%20%20%20%20-%20Expected%20improvement%3A%205-10%25%20MAE%20reduction%0A%20%20%20%20-%20Timeline%3A%202%20weeks%0A%0A%20%20%20%20%23%23%23%20Production%20Readiness%0A%0A%20%20%20%20%E2%9C%85%20**Ready%20for%20Deployment**%0A%20%20%20%20-%20Zero-shot%20model%20achieves%20target%20(15.92%20MW%20%3C%20134%20MW)%0A%20%20%20%20-%20Inference%20time%20acceptable%20(3.45%20min%20for%2038%20borders)%0A%20%20%20%20-%2094.7%25%20of%20borders%20meet%20quality%20threshold%0A%20%20%20%20-%20API%20deployed%20on%20HuggingFace%20Space%20(A100%20GPU)%0A%0A%20%20%20%20%E2%9A%A0%EF%B8%8F%20**Monitor%20These%20Borders**%0A%20%20%20%20-%20AT_DE%2C%20FR_DE%20require%20manual%20review%0A%20%20%20%20-%20Consider%20ensemble%20methods%20or%20manual%20adjustments%20for%20outliers%0A%0A%20%20%20%20%23%23%23%20Cost%20%26%20Infrastructure%0A%0A%20%20%20%20-%20**GPU**%3A%20A100-large%20(40-80%20GB%20VRAM)%20required%20for%20multivariate%20forecasting%0A%20%20%20%20-%20**Cost**%3A%20~%24500%2Fmonth%20for%2024%2F7%20API%20access%0A%20%20%20%20-%20**Alternative**%3A%20Run%20batched%20forecasts%20on%20smaller%20GPU%20(A10G)%20to%20reduce%20costs%0A%0A%20%20%20%20---%0A%0A%20%20%20%20**Document%20Version**%3A%201.0.0%0A%20%20%20%20**Evaluation%20Date**%3A%202024-10-01%20to%202024-10-14%0A%20%20%20%20**Model**%3A%20amazon%2Fchronos-2%20(zero-shot%2C%20615%20features)%0A%20%20%20%20**Author**%3A%20FBMC%20Forecasting%20Team%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
+
+
+2f91438cee0ebd5f8a2caeaf427e9f0795ac9555cb1712a46ca0f04cad6f9694
+
+