Belle II Software development
GroupedDEDXEstimationTrainer Class Reference
Inheritance diagram for GroupedDEDXEstimationTrainer:
DEDXEstimationTrainer FittedGroupedDEDXEstimatorTrainer FunctionFittedGroupedDEDXEstimatorTrainer MaximumEstimatorTrainer MaximumEstimatorTrainerSQRT MedianEstimatorTrainer MedianEstimatorTrainerSQRT GaussianEstimatorTrainer GaussianEstimatorTrainerSQRT LandauEstimatorTrainer LandauEstimatorTrainerSQRT

Public Member Functions

def create_dedx_bins (self, data)
 
def create_p_bins (self, data)
 
def use_only_the_highest_values (self, data, number_of_values=None)
 
def create_fit_data (self, dedx_bin)
 
def fit_p_to_dedx_bin (self, dedx_bin)
 

Static Public Attributes

int number_of_bins_in_dedx = 20
 number of dE/dx bins
 
int number_of_bins_in_p = 29
 number of track-momentum bins
 
int number_of_head_values_used_to_fit = 20
 number of head values in fit
 

Detailed Description

Train a neural network for dE/dx-based particle identification

Definition at line 42 of file train.py.

Member Function Documentation

◆ create_dedx_bins()

def create_dedx_bins (   self,
  data 
)
Construct the dE/dx bins and then populate them with the data

Definition at line 52 of file train.py.

52 def create_dedx_bins(self, data):
53 """Construct the dE/dx bins and then populate them with the data"""
54 dedx_bins = np.linspace(
55 data[
56 self.dedx_column].min(), data[
57 self.dedx_column].max(), GroupedDEDXEstimationTrainer.number_of_bins_in_dedx)
58 dedx_cuts = pd.cut(data[self.dedx_column], dedx_bins)
59 return data.groupby(dedx_cuts), dedx_bins
60

◆ create_fit_data()

def create_fit_data (   self,
  dedx_bin 
)
Fit track-momentum values

Definition at line 74 of file train.py.

74 def create_fit_data(self, dedx_bin):
75 """Fit track-momentum values"""
76 p_binned_data, p_bins = self.create_p_bins(dedx_bin)
77
78 number_of_p_values = pd.Series(p_binned_data.count().p.values, name="number_of_p_values")
79 p_bin_centers = pd.Series(0.5 * (p_bins[:-1] + p_bins[1:]), name="p_bin_centers")
80
81 all_fit_data = pd.DataFrame([number_of_p_values, p_bin_centers]).T
82 fit_data = self.use_only_the_highest_values(all_fit_data, GroupedDEDXEstimationTrainer.number_of_head_values_used_to_fit)
83
84 return fit_data
85

◆ create_p_bins()

def create_p_bins (   self,
  data 
)
Construct the momentum bins and then populate them with the data

Definition at line 61 of file train.py.

61 def create_p_bins(self, data):
62 """Construct the momentum bins and then populate them with the data"""
63 p_bins = np.linspace(data.p.min(), data.p.max(), GroupedDEDXEstimationTrainer.number_of_bins_in_p)
64 p_cuts = pd.cut(data.p, p_bins)
65 return data.groupby(p_cuts), p_bins
66

◆ fit_p_to_dedx_bin()

def fit_p_to_dedx_bin (   self,
  dedx_bin 
)
Fit the track-momentum values in the selected dE/dx bin, then train on the fitted values

Definition at line 86 of file train.py.

86 def fit_p_to_dedx_bin(self, dedx_bin):
87 """Fit the track-momentum values in the selected dE/dx bin, then train on the fitted values"""
88 fit_data = self.create_fit_data(dedx_bin)
89 return self.train_function(fit_data)
90
91

◆ use_only_the_highest_values()

def use_only_the_highest_values (   self,
  data,
  number_of_values = None 
)
Sort the data then select only the highest N values

Definition at line 67 of file train.py.

67 def use_only_the_highest_values(self, data, number_of_values=None):
68 """Sort the data then select only the highest N values"""
69 if number_of_values is None:
70 return data
71 else:
72 return data.sort("number_of_p_values", ascending=False).head(number_of_values).sort()
73

Member Data Documentation

◆ number_of_bins_in_dedx

int number_of_bins_in_dedx = 20
static

number of dE/dx bins

Definition at line 46 of file train.py.

◆ number_of_bins_in_p

int number_of_bins_in_p = 29
static

number of track-momentum bins

Definition at line 48 of file train.py.

◆ number_of_head_values_used_to_fit

int number_of_head_values_used_to_fit = 20
static

number of head values in fit

Definition at line 50 of file train.py.


The documentation for this class was generated from the following file: