5 import torch.nn.functional
as F
12 """Format the dataset that have been written from the Csv file"""
14 @param[in] data: input DataFrame containing 1 event
15 @return: Formatted DataFrame
19 data = data[data[
"nMeasurements"] > 6]
20 data = data.sort_values(
"good/duplicate/fake", ascending=
False)
22 data = data.drop_duplicates(
33 data = data.sort_values(
"particleId")
35 data = data.set_index(
"particleId")
39 for list
in data[
"Hits_ID"].values:
40 hitsIds.append(ast.literal_eval(list))
41 data[
"Hits_ID"] = hitsIds
47 """MLP model used to separate good tracks from duplicate tracks. Return one score per track the higher one correspond to the good track."""
50 """Three layer MLP, 20% dropout, sigmoid activation for the last layer."""
51 super(DuplicateClassifier, self).
__init__()
52 self.
linear1 = nn.Linear(input_dim, n_layers[0])
53 self.
linear2 = nn.Linear(n_layers[0], n_layers[1])
54 self.
linear3 = nn.Linear(n_layers[1], n_layers[2])
55 self.
output = nn.Linear(n_layers[2], 1)
66 """Normalisation of the input before the MLP model."""
70 self.
mean = torch.tensor(mean, dtype=torch.float32)
71 self.
std = torch.tensor(std, dtype=torch.float32)