コード例 #1
0
ファイル: forecasting.py プロジェクト: yangxhcaf/RGCPD
    
    group_line_by = None
#    group_line_by = ['ERA-5', 'EC-Earth']
    col_wrap = None
    wspace = 0.05
    kwrgs = {'wspace':wspace, 'col_wrap':col_wrap}
    met = ['AUC-ROC', 'AUC-PR', 'BSS', 'Rel. Curve']
    kwrgs = {'wspace':0.25, 'col_wrap':3, 'threshold_bin':fc.threshold_pred}
    met = ['AUC-ROC', 'AUC-PR', 'BSS', 'Rel. Curve', 'Precision', 'Accuracy']
    expers = list(dict_experiments.keys())
    models   = list(dict_experiments[expers[0]].keys())
    line_dim = 'model'

    
    fig = dfplots.valid_figures(dict_experiments, expers=expers, models=models,
                              line_dim=line_dim, 
                              group_line_by=group_line_by,  
                              met=met, **kwrgs)

    if f_format == '.png':
        fig.savefig(os.path.join(filename + f_format), 
                    bbox_inches='tight') # dpi auto 600
    elif f_format == '.pdf':
        fig.savefig(os.path.join(pdfs_folder,f_name+ f_format), 
                    bbox_inches='tight')
    
print_sett(list_fc, stat_model_l, filename)


np.save(filename + '.npy', dict_experiments)
#%%
#fcev.plot_scatter()
コード例 #2
0
    'wspace': 0.16,
    'hspace': .25,
    'col_wrap': 2,
    'skip_redundant_title': True,
    'lags_relcurve': [lag_rel],
    'fontbase': 14,
    'figaspect': 2
}
#kwrgs = {'wspace':0.25, 'col_wrap':3, 'threshold_bin':fc.threshold_pred}
met = ['AUC-ROC', 'AUC-PR', 'Precision', 'BSS', 'Accuracy', 'Rel. Curve']
line_dim = 'exper'
group_line_by = None

fig = dfplots.valid_figures(dict_merge_all,
                            line_dim=line_dim,
                            group_line_by=group_line_by,
                            met=met,
                            **kwrgs)

f_format = '.pdf'
pathfig_valid = os.path.join(filename + f_format)
fig.savefig(pathfig_valid, bbox_inches='tight')  # dpi auto 600

fc = list_of_fc[0]
df, fig = fc.plot_feature_importances(lag=lag_rel)
path_feat = filename + f'ifc{1}_logitregul_l{lag_rel}' + f_format
fig.savefig(path_feat, bbox_inches='tight')

fc.dict_sum[0].loc['Precision'].loc['Precision']

fc.dict_sum[0].loc['Accuracy'].loc['Accuracy']
コード例 #3
0
#        dict_experiments[new] = dict_experiments.pop(old)

f_format = '.png'
filename = os.path.join(working_folder, f_name)

group_line_by = None
#group_line_by = ['ERA-5', 'EC']
kwrgs = {'wspace': 0.08}
met = ['AUC-ROC', 'AUC-PR', 'BSS', 'Rel. Curve']
expers = list(dict_experiments.keys())
models = list(dict_experiments[expers[0]].keys())

fig = dfplots.valid_figures(dict_experiments,
                            expers=expers,
                            models=models,
                            line_dim='exper',
                            group_line_by=group_line_by,
                            met=met,
                            **kwrgs)
if f_format == '.png':
    fig.savefig(os.path.join(filename + f_format),
                bbox_inches='tight')  # dpi auto 600
elif f_format == '.pdf':
    fig.savefig(os.path.join(pdfs_folder, f_name + f_format),
                bbox_inches='tight')

print_sett(experiments, stat_model_l, filename)

np.save(filename + '.npy', dict_experiments)
#%%
# =============================================================================
コード例 #4
0
    fc.fit_models(lead_max=35)
    dict_experiments = {}
    fc.perform_validation(n_boot=100, blocksize='auto',
                                  threshold_pred=(1.5, 'times_clim'))
    dict_experiments['test'] = fc.dict_sum


    working_folder, filename = fc._print_sett(list_of_fc=[fc])
    store=True
    dict_all = dfplots.merge_valid_info([fc], store=store)
    if store:
        dict_merge_all = functions_pp.load_hdf5(filename)

    kwrgs = {'wspace':0.25, 'col_wrap':3} #, 'threshold_bin':fc.threshold_pred}
    met = ['AUC-ROC', 'AUC-PR', 'BSS', 'Rel. Curve', 'Precision', 'Accuracy']
    expers = list(dict_experiments.keys())
    line_dim = 'model'


    fig = dfplots.valid_figures(dict_merge_all,
                              line_dim=line_dim,
                              group_line_by=None,
                              lines_legend=None,
                              met=met, **kwrgs)

    # remove created output folders
    shutil.rmtree(rg.path_outsub1)
    shutil.rmtree(os.path.join(main_dir, 'data', 'preprocessed'))


コード例 #5
0
    dict_all = functions_pp.load_hdf5(filename+'.h5')



kwrgs = {'wspace':0.12, 'col_wrap':None, 'lags_relcurve':[10, 20],
         'skip_redundant_title':True, 'fontbase':14}
#kwrgs = {'wspace':0.25, 'col_wrap':3, 'threshold_bin':fc.threshold_pred}
# met = ['Rel. Curve']
met = ['AUC-ROC', 'AUC-PR', 'BSS', 'Rel. Curve']


line_dim = 'exper'


fig = dfplots.valid_figures(dict_all,
                          line_dim=line_dim,
                          group_line_by=None,
                          met=met, **kwrgs)

f_format = '.pdf'
pathfig_valid = os.path.join(filename + f_format)
fig.savefig(pathfig_valid,
            bbox_inches='tight') # dpi auto 600



#%%

# im = 0
# il = 1
# ifc = 0
# f_format = '.pdf'