Belle II Software development
|
Public Member Functions | |
def | __init__ (self, str path, str key, list particlelist, list labels) |
def | __getitem__ (self, index) |
def | __len__ (self) |
torch.tensor | get_split (self, float n_test=0.1) |
Public Attributes | |
x | |
The tensor of features. | |
y | |
The tensor of labels. | |
Dataloader for PID prior probability training. Attributes: x (np.array): Array containing feature data with a second order combination of momentum, cos(theta) and transverse momentum. y (np.array): Array containing the label encoded PDG values.
Definition at line 26 of file priorDataLoaderAndModel.py.
def __init__ | ( | self, | |
str | path, | ||
str | key, | ||
list | particlelist, | ||
list | labels | ||
) |
Initialize the dataloader for PID prior training. Parameters: path (str): Path to the root file containing the data. key (str): Key (i.e. path) of the tree within the root file. particlelist (list(int)): List of particle PDG values for which the model has to be trained. labels (str): Labels of pandas columns containing cos(theta), momentum and PDG values (in this order).
Definition at line 36 of file priorDataLoaderAndModel.py.
def __getitem__ | ( | self, | |
index | |||
) |
Function to get feature and label tensors at the given index location. Parameters: index (int): The index of required tensors. Returns: Tensors of features and labels at the given index.
Definition at line 66 of file priorDataLoaderAndModel.py.
def __len__ | ( | self | ) |
Function to obtain length of a tensor. Parameters: None. Returns: Number of feature sets.
Definition at line 78 of file priorDataLoaderAndModel.py.
torch.tensor get_split | ( | self, | |
float | n_test = 0.1 |
||
) |
Split the input data into training and validation set. Parameter: n_test (float): Ratio of number of particles to be taken in the validation set to that of training set. Return: A randomly split data set with the ratio given by 'n_test'.
Definition at line 90 of file priorDataLoaderAndModel.py.
x |
The tensor of features.
Definition at line 59 of file priorDataLoaderAndModel.py.
y |
The tensor of labels.
Definition at line 64 of file priorDataLoaderAndModel.py.