![]() |
Belle II Software
release-08-02-04
|
Public Member Functions | |
| def | __init__ (self, list particlelist, str Model, str prescaling=None) |
| def | calculate_priors (self, np.array momentum, np.array cosTheta) |
| np.array | get_priors (self, int pdg=None) |
| np.array | get_posterior (self, int pid, int pdg=None) |
Public Attributes | |
| model | |
| The torch model for prior calculation. | |
| scale | |
| Temperature scaling object for calibration. | |
| require_scale | |
| True if the scaling object exist. More... | |
| plist | |
| Sorted particle PDG list. | |
| prior | |
| Numpy array containing PID prior probability data. | |
Class to calculate PID prior probabilities and posteriors.
Attributes:
model(PriorModel): The trained model to be used for evaluation.
plist(np.array): List of particle PDGs for which the model was trained.
require_scale(bool): True if a scaling file is provided or else False.
scale(TemperatureScaling) (optional): Calibration object constructed for temperature scaling.
Definition at line 72 of file evalPriors.py.
| def __init__ | ( | self, | |
| list | particlelist, | ||
| str | Model, | ||
| str | prescaling = None |
||
| ) |
Initialize the Priors class.
Parameters:
particlelist(list(int)): List of PDG values for which the model was trained.
Model(str): Path to a previously trained model which will be used to calculate priors.
prescaling(str) (optional): Path to the scaling file created while training the model.
Definition at line 83 of file evalPriors.py.
| def calculate_priors | ( | self, | |
| np.array | momentum, | ||
| np.array | cosTheta | ||
| ) |
Calculates priors for given momentum and cos(theta).
Parameters:
momentum(np.array): A numpy array containing the momentum of particles.
cosTheta(np.array): A numpy array containing the cosTheta information of particles.
Returns:
None.
Definition at line 111 of file evalPriors.py.
| np.array get_posterior | ( | self, | |
| int | pid, | ||
| int | pdg = None |
||
| ) |
Get PID posterior probabilities.
Parameters:
pid(np.array): The PID values for the particles used during training process arranged in ascending order of PDG values.
pdg(int) (optional): PDG value of particle for which posterior is required.
Returns:
A 1D array of posterior probabilities in case PDG value is provided else returns a 2D array containing
the posteriors for all particles.
Definition at line 152 of file evalPriors.py.
| np.array get_priors | ( | self, | |
| int | pdg = None |
||
| ) |
Gives the calculated PID priors.
Parameters:
pdg(int) (optional): The PDG value of the particles for which prior probabilities are needed.
Returns:
A 1D array conatining prior probabilities for required particle in case PDG value is specified;
else it will return a 2D array for all particles that were used during training.
Definition at line 135 of file evalPriors.py.
| require_scale |
True if the scaling object exist.
False if the scaling object doesn't exist.
Definition at line 104 of file evalPriors.py.