import numpy as np from utils.cross_val import get_cv_results from analysis.plot_utils import plot_reliability, plot_reliability_tilted, plot_QS, plot_crsp, plot_reliability_diff, plot_QS_diff font_scale = 0.7 size = (4.5,3) # ----------------------------------- compare normal, refitted and squared-refitted ------------------------- results_all = np.load('data/cv_res_quantiles_all_squared_partial.npy', allow_pickle=True).item() refit = get_cv_results(results_all['refit']['all']) squared_refit = get_cv_results(results_all['suqared_refit']['all']) results_all = get_cv_results(results_all['no_refit']['all']) results_all['mbt'] = results_all['mgb'] del results_all['mgb'] results_all['mbt refit'] = refit['mgb'] results_all['mbt lin-quad refit'] = squared_refit['mgb'] plot_QS_diff(results_all,size,font_scale=font_scale) plot_reliability_diff(results_all,size,font_scale=font_scale) plot_crsp(results_all,size,font_scale=font_scale) plot_QS(results_all,size,font_scale=font_scale) plot_reliability(results_all,size,font_scale=font_scale) plot_reliability_tilted(results_all,size,font_scale=font_scale)
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sb from utils.cross_val import get_cv_results from analysis.plot_utils import set_figure size = (5, 4) font_scale = 0.7 results = np.load('data/hierarchical_scores.npy', allow_pickle=True) results = get_cv_results(results) results['mbt'] = results['mgb'] name = 'reconciliation_RMSE' f, ax = set_figure(size=size, subplots=(2, 1), w=0.3, h=0.2, b=0.2, font_scale=font_scale) results['bu']['type'] = results['bu'].index results['rec']['type'] = results['rec'].index results['mbt']['type'] = results['mgb'].index results['bu']['method'] = 'bu' results['rec']['method'] = 'rec' results['mbt']['method'] = 'mbt' res_k = pd.concat([results['bu'], results['rec'], results['mbt']]) sb.lineplot(x='sa', y='mape', data=res_k, hue='type', style='method', ax=ax[1]) ax[1].set_ylabel('MAPE [-]') plt.legend(fontsize='small',
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sb from utils.cross_val import get_cv_results from analysis.plot_utils import set_figure font_scale = 0.7 size = (4.5, 4) results = np.load('data/cv_res_m4.npy', allow_pickle=True).item() res_miso, res_mimo, rmse_miso, rmse_mimo, mape_mimo, mape_miso = [{}, {}, {}, {}, {}, {}] res = [] for k in results.keys(): results_k = get_cv_results(results[k]) res.append(pd.DataFrame(results_k, index=[k])) res = pd.concat(res) res['mape wrt mimo'] = res['mape'] / res['mape_mimo'] res['mape wrt miso'] = res['mape'] / res['mape_miso'] res['rmse wrt mimo'] = res['rmse'] / res['rmse_mimo'] res['rmse wrt miso'] = res['rmse'] / res['rmse_miso'] results = np.load('data/cv_res_m4_fourier.npy', allow_pickle=True).item() res_miso, res_mimo, rmse_miso, rmse_mimo, mape_mimo, mape_miso = [{}, {}, {}, {}, {}, {}] for k in results.keys(): results_k = get_cv_results(results[k]) mape = pd.DataFrame(results_k['mape'], index=['mape' ]).T / results_k['mape_miso'] rmse = pd.DataFrame(results_k['rmse'], index=['rmse'
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sb from utils.cross_val import get_cv_results from analysis.plot_utils import set_figure from collections import OrderedDict from matplotlib.ticker import FormatStrFormatter size = (4.5,3) font_scale = 0.7 ns_control = [1] results = np.load('data/vsc_results.npy', allow_pickle=True) results = get_cv_results(results) results_meteo = np.load('data/vsc_results_meteo.npy', allow_pickle=True) results_meteo = get_cv_results(results_meteo) # pretty rename results['mbt lin meteo'] = results_meteo['mbt lin'] results['mbt meteo'] = results_meteo['mbt'] summary = OrderedDict({'rmse':{},'rmse_norm':{}}) for k,v in results.items(): if k in ['mbt', 'mbt meteo'] : continue summary['rmse'][k] = v['rmse'] summary['rmse_norm'][k] = v['norm_rmse']