![]() |
Belle II Software development
|
Public Member Functions | |
__init__ (self, model_file=None, model_config=MODEL_CONFIG, preproc_config=PREPROC_CONFIG, threshold=None, extra_info_var="NN_prediction", global_tag="SmartBKG_GATGAP", payload="GATGAPgen.pth") | |
initialize (self) | |
event (self) | |
Public Attributes | |
model_file = model_file | |
Path to the saved model file. | |
model_config = model_config | |
Parameters for building the model. | |
preproc_config = preproc_config | |
Parameters for preprocessing. | |
threshold = threshold | |
Threshold for event selection using reweighting method, value None indicating sampling method. | |
extra_info_var = extra_info_var | |
Name of eventExtraInfo to save model prediction to. | |
payload = payload | |
Payload for the well-trained model in global tag. | |
model = GATGAPModel(**self.model_config) | |
model with trained parameters | |
EventExtraInfo = Belle2.PyStoreObj('EventExtraInfo') | |
StoreArray to save weights to. | |
EventInfo = Belle2.PyStoreObj('EventMetaData') | |
Initialise event metadata from data store. | |
out_features = self.preproc_config['features'] | |
node features | |
Goals: 1. Build a graph from an event composed of MCParticles 2. Apply the well-trained model for reweighting or sampling method to get a score 3. Execute reweighting or sampling process to get a weight Arguments: model_file(str): Path to the saved model model_config(dict): Parameters to build the model preproc_config(dict): Parameters for preprocessing threshold(float): Threshold for event selection using reweighting method, value *None* indicating sampling method extra_info_var(str): Name of eventExtraInfo to save model prediction to global_tag(str): Tag in ConditionDB where the well trained model was stored payload(str): Payload for the well trained model in global tag Returns: Pass or rejected according to random sampling or selection with the given threshold Note: Score after the NN filter indicating the probability of the event to pass is saved under ``EventExtraInfo.extra_info_var``. Use ``eventExtraInfo(extra_info_var)`` in ``modularAnalysis.variablesToNtuple`` or ``additionalBranches=["EventExtraInfo"]`` in ``mdst.add_mdst_output`` to have access to the scores.
Definition at line 23 of file NN_filter_module.py.
__init__ | ( | self, | |
model_file = None, | |||
model_config = MODEL_CONFIG, | |||
preproc_config = PREPROC_CONFIG, | |||
threshold = None, | |||
extra_info_var = "NN_prediction", | |||
global_tag = "SmartBKG_GATGAP", | |||
payload = "GATGAPgen.pth" ) |
Initialise the class. :param model_file: Path to the saved model file. :param model_config: Parameters for building the model. :param preproc_config: Parameters for preprocessing. :param threshold: Threshold for event selection using reweighting method, value *None* indicating sampling method. :param extra_info_var: Name of eventExtraInfo to save model prediction to. :param global_tag: Tag in ConditionDB where the well-trained model was stored. :param payload: Payload for the well-trained model in global tag.
Definition at line 50 of file NN_filter_module.py.
event | ( | self | ) |
Collect information from database, build graphs, make predictions and select through sampling or threshold
Definition at line 111 of file NN_filter_module.py.
initialize | ( | self | ) |
Initialise module before any events are processed
Definition at line 87 of file NN_filter_module.py.
EventExtraInfo = Belle2.PyStoreObj('EventExtraInfo') |
StoreArray to save weights to.
Definition at line 102 of file NN_filter_module.py.
EventInfo = Belle2.PyStoreObj('EventMetaData') |
Initialise event metadata from data store.
Definition at line 105 of file NN_filter_module.py.
extra_info_var = extra_info_var |
Name of eventExtraInfo to save model prediction to.
Definition at line 80 of file NN_filter_module.py.
model = GATGAPModel(**self.model_config) |
model with trained parameters
Definition at line 98 of file NN_filter_module.py.
model_config = model_config |
Parameters for building the model.
Definition at line 74 of file NN_filter_module.py.
model_file = model_file |
Path to the saved model file.
Definition at line 72 of file NN_filter_module.py.
out_features = self.preproc_config['features'] |
node features
Definition at line 107 of file NN_filter_module.py.
payload = payload |
Payload for the well-trained model in global tag.
Definition at line 82 of file NN_filter_module.py.
preproc_config = preproc_config |
Parameters for preprocessing.
Definition at line 76 of file NN_filter_module.py.
threshold = threshold |
Threshold for event selection using reweighting method, value None indicating sampling method.
Definition at line 78 of file NN_filter_module.py.