Belle II Software  release-08-01-10
PIDNeuralNetworkParameters Class Reference

Class for handling the parameters for the neural-network PID. More...

#include <PIDNeuralNetworkParameters.h>

Inheritance diagram for PIDNeuralNetworkParameters:
Collaboration diagram for PIDNeuralNetworkParameters:

Public Member Functions

 PIDNeuralNetworkParameters ()
 Constructor.
 
 PIDNeuralNetworkParameters (const std::string &description, const std::vector< std::string > &inputNames, const std::string &modelDefinition, const std::vector< int > &outputSpeciesPdg, const std::vector< float > &meanValues, const std::vector< float > &standardDeviations, const PIDNNMissingInputs &handleMissingInputs, const PIDNNInputsToCut &inputsToCut)
 Construct with individual neural-network parameters.
 
int pdg2OutputIndex (const int pdg, const bool throwException=true) const
 Convert pdg code to the index of the neural-network output that represents the corresponding probability. More...
 
bool hasPdgCode (const int pdg, const bool throwException=false) const
 
const std::string & getModelDefinition () const
 Get the neural network model-definition string for frugally-deep. More...
 
const std::vector< float > & getMeanValues () const
 Get the mean values of the inputs for normalization. More...
 
const std::vector< float > & getStandardDeviations () const
 Get the standard deviations of the inputs for normalization. More...
 
const PIDNNMissingInputsgetHandleMissingInputs () const
 Get vector of input indices and corresponding values that are set if the corresponding input is NaN. More...
 
const PIDNNInputsToCutgetInputsToCut () const
 Get vector of input indices, whose values are overwritten if other input variables are in a certain range. More...
 
size_t getInputSize () const
 Get number of inputs. More...
 
const std::vector< std::string > & getInputNames () const
 Get input names. More...
 
size_t getInputIndex (const std::string &name) const
 Get input index for input name. More...
 
const std::string & getDescription () const
 Get neural network description. More...
 
const std::vector< int > & getOutputSpeciesPdg () const
 Get the list of pdg codes of species hypotheses, for which the network predicts the probability in the order defined by the network output layer. More...
 

Private Member Functions

 ClassDef (PIDNeuralNetworkParameters, 1)
 ClassDef as this is a TObject.
 

Private Attributes

std::string m_description
 description of neural network parameters
 
std::vector< std::string > m_inputNames
 list of input names
 
std::string m_modelDefinition
 neural network string for frugally-deep
 
std::vector< int > m_outputSpeciesPdg
 PDG codes of hypotheses of neural-network output.
 
std::vector< float > m_meanValues
 mean values of inputs
 
std::vector< float > m_standardDeviations
 standard deviations of inputs
 
PIDNNMissingInputs m_handleMissingInputs
 handling of NaN inputs
 
PIDNNInputsToCut m_inputsToCut
 overwrite certain input variables
 

Detailed Description

Class for handling the parameters for the neural-network PID.

Definition at line 45 of file PIDNeuralNetworkParameters.h.

Member Function Documentation

◆ getDescription()

const std::string& getDescription ( ) const
inline

Get neural network description.

Returns
const std::string& neural network description

Definition at line 135 of file PIDNeuralNetworkParameters.h.

135 {return m_description;}
std::string m_description
description of neural network parameters

◆ getHandleMissingInputs()

const PIDNNMissingInputs& getHandleMissingInputs ( ) const
inline

Get vector of input indices and corresponding values that are set if the corresponding input is NaN.

Returns
const PIDNNMissingInputs& missing input handnling information

Definition at line 108 of file PIDNeuralNetworkParameters.h.

◆ getInputIndex()

size_t getInputIndex ( const std::string &  name) const

Get input index for input name.

Parameters
nameInput name that should be matched to a index
Returns
size_t input index, -1 if name not in inputs

Definition at line 32 of file PIDNeuralNetworkParameters.cc.

33 {
34  const auto itr = std::find(m_inputNames.begin(), m_inputNames.end(), name);
35  if (itr == m_inputNames.end()) B2FATAL("Invalid input name: " << name);
36  return static_cast<size_t>(itr - m_inputNames.begin());
37 }
std::vector< std::string > m_inputNames
list of input names

◆ getInputNames()

const std::vector<std::string>& getInputNames ( ) const
inline

Get input names.

Returns
const std::vector<std::string>& input names

Definition at line 123 of file PIDNeuralNetworkParameters.h.

◆ getInputSize()

size_t getInputSize ( ) const
inline

Get number of inputs.

Returns
size_t number of inputs

Definition at line 118 of file PIDNeuralNetworkParameters.h.

◆ getInputsToCut()

const PIDNNInputsToCut& getInputsToCut ( ) const
inline

Get vector of input indices, whose values are overwritten if other input variables are in a certain range.

Returns
const PIDNNInputsToCut& overwrite inputs information

Definition at line 113 of file PIDNeuralNetworkParameters.h.

◆ getMeanValues()

const std::vector<float>& getMeanValues ( ) const
inline

Get the mean values of the inputs for normalization.

Returns
const std::vector<float>& input mean values

Definition at line 98 of file PIDNeuralNetworkParameters.h.

◆ getModelDefinition()

const std::string& getModelDefinition ( ) const
inline

Get the neural network model-definition string for frugally-deep.

Returns
const std::string& model-definition string

Definition at line 93 of file PIDNeuralNetworkParameters.h.

◆ getOutputSpeciesPdg()

const std::vector<int>& getOutputSpeciesPdg ( ) const
inline

Get the list of pdg codes of species hypotheses, for which the network predicts the probability in the order defined by the network output layer.

Returns
const std::vector<int>& list of pdg codes of hypotheses predicted by the network

Definition at line 142 of file PIDNeuralNetworkParameters.h.

◆ getStandardDeviations()

const std::vector<float>& getStandardDeviations ( ) const
inline

Get the standard deviations of the inputs for normalization.

Returns
const std::vector<float>& input standard deviations

Definition at line 103 of file PIDNeuralNetworkParameters.h.

◆ hasPdgCode()

bool hasPdgCode ( const int  pdg,
const bool  throwException = false 
) const
inline
Parameters
pdgpdg code of hypothesis
throwExceptionthrow exception if pdg code is not predicted
Returns
true if neural network predicts probability for the given hypothesis
false if neural network does not predict probability for the given hypothesis

Definition at line 87 of file PIDNeuralNetworkParameters.h.

◆ pdg2OutputIndex()

int pdg2OutputIndex ( const int  pdg,
const bool  throwException = true 
) const

Convert pdg code to the index of the neural-network output that represents the corresponding probability.

Parameters
pdgPDG code for particle-species hypothesis
throwExceptionthrow exception if pdg code is not predicted
Returns
int Index of neural-network output. -1 if pdg code not predicted by neural network

Definition at line 19 of file PIDNeuralNetworkParameters.cc.


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