del preds, probs, pred_probs, upper, lower, X_test, y_test, \ trained_model, data_test, data_vector_test, data_ind_test metrics = pd.DataFrame( np.column_stack([pctls, accuracy, precision, recall, f1, roc_auc]), columns=[ 'cloud_cover', 'accuracy', 'precision', 'recall', 'f1', 'auc' ]) metrics.to_csv(metrics_path / 'metrics.csv', index=False) times = [ float(i) for i in times ] # Convert time objects to float, otherwise valMetrics will be non-numeric times_df = pd.DataFrame(np.column_stack([pctls, times]), columns=['cloud_cover', 'testing_time']) times_df.to_csv(metrics_path / 'testing_times.csv', index=False) # ====================================================================================================================== log_reg_training_sample(img_list, pctls, feat_list_new, feat_list_all, data_path, batch, n_flood, n_nonflood) log_reg_prediction_sample(img_list, pctls, feat_list_all, data_path, batch) viz = VizFuncs(viz_params) viz.metric_plots() viz.metric_plots_multi() viz.time_plot() viz.false_map(probs=True, save=False) viz.false_map_borders() viz.uncertainty_map_LR() viz.fpfn_map(probs=True)
accuracy.append(accuracy_score(y_test, preds)) precision.append(precision_score(y_test, preds)) recall.append(recall_score(y_test, preds)) f1.append(f1_score(y_test, preds)) del preds, p_hat, aleatoric, epistemic, X_test, y_test, model, data_test, data_vector_test, data_ind_test metrics = pd.DataFrame( np.column_stack([pctls, accuracy, precision, recall, f1]), columns=['cloud_cover', 'accuracy', 'precision', 'recall', 'f1']) metrics.to_csv(metrics_path / 'metrics.csv', index=False) times = [float(i) for i in times] times_df = pd.DataFrame(np.column_stack([pctls, times]), columns=['cloud_cover', 'testing_time']) times_df.to_csv(metrics_path / 'testing_times.csv', index=False) # ====================================================================================================================== training_BNN_gen_model(img_list_train, feat_list_new, model_func, data_path, batch, dropout_rate, **model_params) prediction_BNN_gen_model(img_list_test, pctls, feat_list_new, data_path, batch, MC_passes, **model_params) viz = VizFuncs(viz_params) viz.metric_plots() viz.metric_plots_multi() viz.time_plot() viz.false_map(probs=False, save=False) viz.false_map_borders() viz.fpfn_map() viz.uncertainty_map_NN()
'img_list': img_list, 'pctls': pctls, 'data_path': data_path, 'batch': batch, 'feat_list_new': feat_list_new } # NUM_PARALLEL_EXEC_UNITS = 8 # config = tf.compat.v1.ConfigProto(intra_op_parallelism_threads=NUM_PARALLEL_EXEC_UNITS, inter_op_parallelism_threads=4, # allow_soft_placement=True, device_count={'CPU': NUM_PARALLEL_EXEC_UNITS}) # session = tf.compat.v1.Session(config=config) # tf.compat.v1.keras.backend.set_session(session) # os.environ["KMP_BLOCKTIME"] = "30" # os.environ["KMP_SETTINGS"] = "1" # os.environ["KMP_AFFINITY"] = "granularity=fine,verbose,compact,1,0" # os.environ['MKL_NUM_THREADS'] = str(NUM_PARALLEL_EXEC_UNITS) # os.environ['GOTO_NUM_THREADS'] = str(NUM_PARALLEL_EXEC_UNITS) # os.environ['OMP_NUM_THREADS'] = str(NUM_PARALLEL_EXEC_UNITS) # ====================================================================================================================== training_bnn_kwon(img_list, pctls, model_func, feat_list_new, data_path, batch, dropout_rate, **model_params) prediction_bnn_kwon(img_list, pctls, feat_list_new, data_path, batch, MC_passes, **model_params) viz = VizFuncs(viz_params) viz.time_plot() viz.false_map(probs=False, save=False) viz.false_map_borders() viz.uncertainty_map_NN() viz.fpfn_map(probs=False)