Exemple #1
0
def get_35_tune(pathlist, sizes, expr_num):
    #get experiment info
    first8, second8, third8 = pathlist
    start_size, iter_size = sizes
    explore_cond_list = ['diverse', 'random']
    #yes I'm using mod2 to index, sue me.
    explore_type = explore_cond_list[expr_num % 2]
    exp_cond = 'Exp_' + str(expr_num) + '  Start:' + str(
        start_size / 100) + ', Iter:' + str(
            iter_size / 100) + ', Explore:' + explore_type
    save_path = os.path.join(data_dir, first8)
    pickle_off = open(save_path, 'rb')
    first8 = pickle.load(pickle_off)
    pickle_off.close()
    save_path = os.path.join(data_dir, second8)
    pickle_off = open(save_path, 'rb')
    second8 = pickle.load(pickle_off)
    pickle_off.close()
    save_path = os.path.join(data_dir, third8)
    pickle_off = open(save_path, 'rb')
    third8 = pickle.load(pickle_off)
    pickle_off.close()

    #combine the 3 dfs with GCNN RF,SVM,LGBM data
    expr_1 = first8
    expr_2 = second8
    expr_3 = third8

    tune_list = []
    for exper in [expr_1, expr_2, expr_3]:
        exper = find_active_percents(exper, exp)
        random_checkpoint = get_checkpoint35(exper, start_size, iter_size)
        class_selection_list = []
        expr_num_list = []
        for _, row in random_checkpoint.iterrows():
            class_selection_list.append(exp_cond)
            expr_num_list.append('Exp_' + str(expr_num))

        random_checkpoint['Exp_Cond'] = class_selection_list
        random_checkpoint['Exp_num'] = expr_num_list
        tune_list.append(random_checkpoint)
    merged_tune = pd.concat(tune_list)
    return merged_tune
pickle_off = open(save_path, 'rb')
second8 = pickle.load(pickle_off)
pickle_off.close()
save_path = os.path.join(data_dir, third8)
pickle_off = open(save_path, 'rb')
third8 = pickle.load(pickle_off)
pickle_off.close()

#combine the 3 dfs with GCNN RF,SVM,LGBM data
expr_1 = first8
expr_2 = second8
expr_3 = third8

from iter_plot_help_funcs import find_active_percents, plot_metrics, plot_prec_rec_curve, plot_prec_rec_vs_tresh
for exper in [expr_1, expr_2, expr_3]:
    exper = find_active_percents(exper, exp)
#    plot_metrics(exper,exp)
#    plot_prec_rec_curve(exper,exp)
#    plot_prec_rec_vs_tresh(exper,exp)
#    break
#get gCNN rows:
from iter_plot_help_funcs import find_active_percents, plot_metrics, plot_prec_rec_curve, plot_prec_rec_vs_tresh, plot_avg_percent_found, set_sns_pal
plot_avg_percent_found(pd.concat([expr_1, expr_2, expr_3]),
                       'Mean Active Recovery for Exp_4', 15, 10)
for exper in [expr_1, expr_2, expr_3]:
    exper_gcnn = exper[exper['Classifier'] == 'GCNN_pytorch']
    df_list = []
    for _, row in exper_gcnn.iterrows():
        hist = row['hist']
        row_df = pd.DataFrame(hist)
        test = pd.melt(row_df.reset_index(),