def show_centerd_uncertainty(data, iteration, exp=False):
    print(data['iterations_results'][iteration].keys())
    if exp:
        preds = np.exp(np.array(data['iterations_results'][iteration]['pred_labels']))
        upper = np.exp(np.array(data['iterations_results'][iteration]['uncertainty_high']))
        lower = np.exp(np.array(data['iterations_results'][iteration]['uncertainty_low']))
    else:
        preds = np.array(data['iterations_results'][iteration]['pred_labels'])
        upper = np.array(data['iterations_results'][iteration]['uncertainty_high'])
        lower = np.array(data['iterations_results'][iteration]['uncertainty_low'])
    IQR_interval = (upper - lower)
    sort_ind = np.argsort(IQR_interval)
    preds = preds[sort_ind]
    upper = upper[sort_ind]
    lower = lower[sort_ind]
    mean = ((upper + lower) / 2)
    std = np.std((upper + lower))
    upper_centered = upper.copy()
    lower_centered = lower.copy()
    preds_centered = preds.copy()
    upper_centered = (upper_centered - mean)
    lower_centered = (lower_centered - mean)
    preds_centered = (preds_centered - mean)
    IRQ_th = np.quantile(IQR_interval, 0.95)
    print(IRQ_th)
    x_idx = np.arange(len(upper_centered))
    cut = x_idx[(IQR_interval[sort_ind] > IRQ_th)]
    print(cut)
    (fig, ax) = plt.subplots(1, 1, figsize=(8, 4))
    ax.plot(preds_centered, marker='.', color='#ff7f0e', linewidth=0)
    ax.fill_between(np.arange(len(upper_centered)), lower_centered, upper_centered, alpha=0.2, color='#ff7f0e', label='Pred. interval (centerd)')
    ax.axvline(cut[0], color='red', linestyle='--', label='Threshold $\\eta$')
    ax.set_xlabel('Non-executed jobs sorted by uncertainty.')
    ax.set_ylabel('Predicted values (centered)')
    ax.legend()
def show_centerd_uncertainty(data, iteration, exp=False):
    print(data['iterations_results'][iteration].keys())
    if exp:
        preds = np.exp(np.array(data['iterations_results'][iteration]['pred_labels']))
        upper = np.exp(np.array(data['iterations_results'][iteration]['uncertainty_high']))
        lower = np.exp(np.array(data['iterations_results'][iteration]['uncertainty_low']))
    else:
        preds = np.array(data['iterations_results'][iteration]['pred_labels'])
        upper = np.array(data['iterations_results'][iteration]['uncertainty_high'])
        lower = np.array(data['iterations_results'][iteration]['uncertainty_low'])
    IQR_interval = (upper - lower)
    sort_ind = np.argsort(IQR_interval)
    preds = preds[sort_ind]
    upper = upper[sort_ind]
    lower = lower[sort_ind]
    mean = ((upper + lower) / 2)
    std = np.std((upper + lower))
    upper_centered = upper.copy()
    lower_centered = lower.copy()
    preds_centered = preds.copy()
    upper_centered = (upper_centered - mean)
    lower_centered = (lower_centered - mean)
    preds_centered = (preds_centered - mean)
    IRQ_th = np.quantile(IQR_interval, 0.95)
    print(IRQ_th)
    x_idx = np.arange(len(upper_centered))
    cut = x_idx[(IQR_interval[sort_ind] > IRQ_th)]
    print(cut)
    (fig, ax) = plt.subplots(1, 1, figsize=(8, 4))
    ax.plot(preds_centered, marker='.', color='#ff7f0e', linewidth=0)
    ax.fill_between(np.arange(len(upper_centered)), lower_centered, upper_centered, alpha=0.2, color='#ff7f0e', label='Pred. interval (centerd)')
    ax.axvline(cut[0], color='red', linestyle='--', label='Threshold $\\eta$')
    ax.set_xlabel('Non-executed jobs sorted by uncertainty.')
    ax.set_ylabel('Predicted values (centered)')
    ax.legend()