Class for handling the parameters for the neural-network PID.
More...
#include <PIDNeuralNetworkParameters.h>
|
| | 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.
|
| |
| 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.
|
| |
| const std::vector< float > & | getMeanValues () const |
| | Get the mean values of the inputs for normalization.
|
| |
| const std::vector< float > & | getStandardDeviations () const |
| | Get the standard deviations of the inputs for normalization.
|
| |
| const PIDNNMissingInputs & | getHandleMissingInputs () const |
| | Get vector of input indices and corresponding values that are set if the corresponding input is NaN.
|
| |
| const PIDNNInputsToCut & | getInputsToCut () const |
| | Get vector of input indices, whose values are overwritten if other input variables are in a certain range.
|
| |
| size_t | getInputSize () const |
| | Get number of inputs.
|
| |
| const std::vector< std::string > & | getInputNames () const |
| | Get input names.
|
| |
| size_t | getInputIndex (const std::string &name) const |
| | Get input index for input name.
|
| |
| const std::string & | getDescription () const |
| | Get neural network description.
|
| |
| 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.
|
| |
Class for handling the parameters for the neural-network PID.
Definition at line 42 of file PIDNeuralNetworkParameters.h.
◆ PIDNeuralNetworkParameters() [1/2]
◆ PIDNeuralNetworkParameters() [2/2]
| 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 ) |
|
inline |
Construct with individual neural-network parameters.
Definition at line 51 of file PIDNeuralNetworkParameters.h.
59 :
60 m_description(description),
61 m_inputNames(inputNames),
62 m_modelDefinition(modelDefinition),
63 m_outputSpeciesPdg(outputSpeciesPdg),
64 m_meanValues(meanValues),
65 m_standardDeviations(standardDeviations),
66 m_handleMissingInputs(handleMissingInputs),
67 m_inputsToCut(inputsToCut)
68 {}
◆ getDescription()
| const std::string & getDescription |
( |
| ) |
const |
|
inline |
Get neural network description.
- Returns
- const std::string& neural network description
Definition at line 132 of file PIDNeuralNetworkParameters.h.
132{return m_description;}
◆ getHandleMissingInputs()
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 105 of file PIDNeuralNetworkParameters.h.
105{return m_handleMissingInputs;}
◆ getInputIndex()
| size_t getInputIndex |
( |
const std::string & | name | ) |
const |
Get input index for input name.
- Parameters
-
| name | Input name that should be matched to a index |
- Returns
- size_t input index, -1 if
name not in inputs
Definition at line 31 of file PIDNeuralNetworkParameters.cc.
32{
34 if (itr ==
m_inputNames.end()) B2FATAL(
"Invalid input name: " << name);
36}
std::vector< std::string > m_inputNames
list of input names
◆ getInputNames()
| const std::vector< std::string > & getInputNames |
( |
| ) |
const |
|
inline |
◆ getInputSize()
| size_t getInputSize |
( |
| ) |
const |
|
inline |
◆ getInputsToCut()
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 110 of file PIDNeuralNetworkParameters.h.
110{return m_inputsToCut;}
◆ 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 95 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 90 of file PIDNeuralNetworkParameters.h.
90{return m_modelDefinition;}
◆ 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 139 of file PIDNeuralNetworkParameters.h.
139{return m_outputSpeciesPdg;}
◆ 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 100 of file PIDNeuralNetworkParameters.h.
100{return m_standardDeviations;}
◆ hasPdgCode()
| bool hasPdgCode |
( |
const int | pdg, |
|
|
const bool | throwException = false ) const |
|
inline |
- Parameters
-
| pdg | pdg code of hypothesis |
| throwException | throw 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 84 of file PIDNeuralNetworkParameters.h.
84{return pdg2OutputIndex(pdg, throwException) >= 0;}
◆ 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
-
| pdg | PDG code for particle-species hypothesis |
| throwException | throw 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 18 of file PIDNeuralNetworkParameters.cc.
19{
22 if (throwException)
23 B2FATAL("Invalid particle-species hypothesis: " << pdg
24 << ". PID neural network is not trained for this particle-species hypothesis");
25 return -1;
26 }
28}
std::vector< int > m_outputSpeciesPdg
PDG codes of hypotheses of neural-network output.
◆ m_description
| std::string m_description |
|
private |
◆ m_handleMissingInputs
◆ m_inputNames
| std::vector<std::string> m_inputNames |
|
private |
◆ m_inputsToCut
◆ m_meanValues
| std::vector<float> m_meanValues |
|
private |
◆ m_modelDefinition
| std::string m_modelDefinition |
|
private |
◆ m_outputSpeciesPdg
| std::vector<int> m_outputSpeciesPdg |
|
private |
◆ m_standardDeviations
| std::vector<float> m_standardDeviations |
|
private |
The documentation for this class was generated from the following files: