def compare_td_gen_r2(results, results_td_gen):
    data_size = results['data_size']
    test_scores = results['test_scores_exp']
    from sklearn.metrics import r2_score
    td_gen_scores = []
    x = []
    for (k, v) in results_td_gen.items():
        y_test = v['test_labels']
        y_pred = v['pred_labels']
        score = r2_score(y_test, y_pred)
        print(k, 'R2 score:', score)
        td_gen_scores.append(score)
        x.append(k)
    (fig, ax) = plt.subplots(figsize=(8, 2))
    ax.plot(td_gen_scores, linestyle='--', marker='o', label='TDGen', color=sns.color_palette()[4])
    ax.plot(list(map((lambda x: x['r2']), test_scores)), marker='o', label='Our solution', color='#111111')
    ax.set_xticks(list(range(data_size.__len__())))
    ax.set_xticklabels(data_size, rotation=60)
    print((np.array(list(map((lambda x: x['r2']), test_scores))) / np.array(td_gen_scores)))
    ax.set_xlabel('# Cumulated Executed Jobs')
    ax.set_ylabel('$R^2$ of pred. Exec. Time')
    ax.legend()
    return ax
def compare_td_gen_r2(results, results_td_gen):
    data_size = results['data_size']
    test_scores = results['test_scores_exp']
    from sklearn.metrics import r2_score
    td_gen_scores = []
    x = []
    for (k, v) in results_td_gen.items():
        y_test = v['test_labels']
        y_pred = v['pred_labels']
        score = r2_score(y_test, y_pred)
        print(k, 'R2 score:', score)
        td_gen_scores.append(score)
        x.append(k)
    (fig, ax) = plt.subplots(figsize=(8, 2))
    ax.plot(td_gen_scores, linestyle='--', marker='o', label='TDGen', color=sns.color_palette()[4])
    ax.plot(list(map((lambda x: x['r2']), test_scores)), marker='o', label='Our solution', color='#111111')
    ax.set_xticks(list(range(data_size.__len__())))
    ax.set_xticklabels(data_size, rotation=60)
    print((np.array(list(map((lambda x: x['r2']), test_scores))) / np.array(td_gen_scores)))
    ax.set_xlabel('# Cumulated Executed Jobs')
    ax.set_ylabel('$R^2$ of pred. Exec. Time')
    ax.legend()
    return ax