|
string | __version__ = '1.0' |
|
string | __author__ = 'Saul Alonso-Monsalve' |
|
string | __email__ = "saul.alonso.monsalve@cern.ch" |
|
| stream |
|
| stdout |
|
| level |
|
| config = configparser.ConfigParser() |
|
| SEED = int(config['random']['seed']) |
|
| SHUFFLE = ast.literal_eval(config['random']['shuffle']) |
|
| IMAGES_PATH = config['images']['path'] |
|
| VIEWS = int(config['images']['views']) |
|
| PLANES = int(config['images']['planes']) |
|
| CELLS = int(config['images']['cells']) |
|
| STANDARDIZE = ast.literal_eval(config['images']['standardize']) |
|
| DATASET_PATH = config['dataset']['path'] |
|
| PARTITION_PREFIX = config['dataset']['partition_prefix'] |
|
| LABELS_PREFIX = config['dataset']['labels_prefix'] |
|
| CHECKPOINT_PATH = config['model']['checkpoint_path'] |
|
| CHECKPOINT_PREFIX = config['model']['checkpoint_prefix'] |
|
| CHECKPOINT_SAVE_MANY = ast.literal_eval(config['model']['checkpoint_save_many']) |
|
| CHECKPOINT_SAVE_BEST_ONLY = ast.literal_eval(config['model']['checkpoint_save_best_only']) |
|
| PRINT_SUMMARY = ast.literal_eval(config['model']['print_summary']) |
|
| BRANCHES = ast.literal_eval(config['model']['branches']) |
|
| PARALLELIZE = ast.literal_eval(config['model']['parallelize']) |
|
| OUTPUTS = int(config['model']['outputs']) |
|
| OUTPUT_PATH = config['test']['output_path'] |
|
| OUTPUT_PREFIX = config['test']['output_prefix'] |
|
| CUT_NUE = float(config['test']['cut_nue']) |
|
| CUT_NUMU = float(config['test']['cut_numu']) |
|
| CUT_NUTAU = float(config['test']['cut_nutau']) |
|
| CUT_NC = float(config['test']['cut_nc']) |
|
| TEST_BATCH_SIZE = int(config['test']['batch_size']) |
|
list | test_values = [] |
|
dictionary | TEST_PARAMS |
|
| partition = pickle.load(partition_file) |
|
| labels = pickle.load(labels_file) |
|
| prediction_generator = DataGenerator(**TEST_PARAMS).generate(labels, partition['test'], False) |
|
list | files = [f for f in os.listdir(CHECKPOINT_PATH) if os.path.isfile(os.path.join(CHECKPOINT_PATH, f))] |
|
| reverse |
|
| r = re.compile(CHECKPOINT_PREFIX[1:] + '-.*-.*.h5') |
|
| model |
|
list | is_antineutrino_target_names = ['neutrino', 'antineutrino', 'NULL'] |
|
list | flavour_target_names = ['CC Numu', 'CC Nue', 'CC Nutau', 'NC'] |
|
list | interaction_target_names = ['CC QE', 'CC Res', 'CC DIS', 'CC Other', 'NULL'] |
|
list | categories_target_names |
|
list | protons_target_names = ['0', '1', '2', '>2'] |
|
list | pions_target_names = ['0', '1', '2', '>2'] |
|
list | pizeros_target_names = ['0', '1', '2', '>2'] |
|
list | neutrons_target_names = ['0', '1', '2', '>2'] |
|
| Y_pred |
|
| y_pred_categories = np.argmax(Y_pred, axis=1).reshape((Y_pred.shape[0], 1)) |
|
| Y_pred_flavour = np.zeros((Y_pred.shape[0], 4)) |
|
| y_test_categories = np.array([12 if aux['y_value'] == 13 else aux['y_value'] for aux in test_values]).reshape(y_pred_categories.shape) |
|
| y_test_flavour = np.zeros(y_test_categories.shape, dtype=int) |
|
| p = Y_pred[i] |
|
| y_pred_flavour = np.argmax(Y_pred_flavour, axis=1) |
|
| flavour_conf_matrix = confusion_matrix(y_pred_flavour, y_test_flavour) |
|
| categories_conf_matrix = confusion_matrix(y_pred_categories, y_test_categories) |
|
| weighted_conf_matrix = np.zeros((4,4), dtype='float32') |
|
| cut_weighted_conf_matrix = np.zeros((4,4), dtype='float32') |
|
| pred_flavour = int(y_pred_flavour[sample]) |
|
| test_flavour = int(y_test_flavour[sample]) |
|
| weight = test_values[sample]['fEventWeight'] |
|
string | float_formatter = lambdax:"%.4f" |
|
| formatter |
|
| purity_conf_matrix = np.copy(cut_weighted_conf_matrix) |
|
| row_sum = np.sum(purity_conf_matrix[i]) |
|
| efficiency_conf_matrix = cut_weighted_conf_matrix.astype('float32')/np.add.reduce(weighted_conf_matrix) |
|
| y_pred_is_antineutrino = np.around(Y_pred[0]).reshape((Y_pred[0].shape[0], 1)).astype(int) |
|
| y_pred_interaction = np.argmax(Y_pred[2], axis=1).reshape((Y_pred[2].shape[0], 1)) |
|
| y_pred_protons = np.argmax(Y_pred[3], axis=1).reshape((Y_pred[3].shape[0], 1)) |
|
| y_pred_pions = np.argmax(Y_pred[4], axis=1).reshape((Y_pred[4].shape[0], 1)) |
|
| y_pred_pizeros = np.argmax(Y_pred[5], axis=1).reshape((Y_pred[5].shape[0], 1)) |
|
| y_pred_neutrons = np.argmax(Y_pred[6], axis=1).reshape((Y_pred[6].shape[0], 1)) |
|
| y_test_is_antineutrino = np.array([aux['y_value'][0] for aux in test_values]).reshape(y_pred_is_antineutrino.shape) |
|
| y_test_interaction = np.array([aux['y_value'][2] for aux in test_values]).reshape(y_pred_interaction.shape) |
|
| y_test_protons = np.array([aux['y_value'][3] for aux in test_values]).reshape(y_pred_protons.shape) |
|
| y_test_pions = np.array([aux['y_value'][4] for aux in test_values]).reshape(y_pred_pions.shape) |
|
| y_test_pizeros = np.array([aux['y_value'][5] for aux in test_values]).reshape(y_pred_pizeros.shape) |
|
| y_test_neutrons = np.array([aux['y_value'][6] for aux in test_values]).reshape(y_pred_neutrons.shape) |
|
| is_antineutrino_conf_matrix = confusion_matrix(y_pred_is_antineutrino, y_test_is_antineutrino) |
|
| interaction_conf_matrix = confusion_matrix(y_pred_interaction, y_test_interaction) |
|
| protons_conf_matrix = confusion_matrix(y_pred_protons, y_test_protons) |
|
| pions_conf_matrix = confusion_matrix(y_pred_pions, y_test_pions) |
|
| pizeros_conf_matrix = confusion_matrix(y_pred_pizeros, y_test_pizeros) |
|
| neutrons_conf_matrix = confusion_matrix(y_pred_neutrons, y_test_neutrons) |
|
dictionary | test_info |
|