Predict neural-network output for all implemented hypotheses using the given inputs.
37 for (
auto const& inputToCut : (*m_pidNeuralNetworkParametersDB)->getInputsToCut()) {
38 const auto [inputSetIndex, inputCutIndex, rangeStart, rangeEnd, setValue] = inputToCut;
39 if (!std::isnan(rangeStart) and !std::isnan(rangeEnd)) {
40 if (input[inputCutIndex] >= rangeStart and input[inputCutIndex] <= rangeEnd)
41 input[inputSetIndex] = setValue;
42 }
else if (!std::isnan(rangeStart)) {
43 if (input[inputCutIndex] >= rangeStart)
44 input[inputSetIndex] = setValue;
45 }
else if (!std::isnan(rangeEnd)) {
46 if (input[inputCutIndex] <= rangeEnd)
47 input[inputSetIndex] = setValue;
53 for (
size_t i = 0; i < input.size(); ++i) {
54 input[i] = (input[i] - (*m_pidNeuralNetworkParametersDB)->getMeanValues()[i]) /
55 (*m_pidNeuralNetworkParametersDB)->getStandardDeviations()[i];
59 for (
auto const& index_value : (*m_pidNeuralNetworkParametersDB)->getHandleMissingInputs()) {
60 const auto [index, value] = index_value;
61 if (std::isnan(input[index])) input[index] = value;
65 const auto inputFdeep = fdeep::tensor(fdeep::tensor_shape(input.size()), input);
66 const auto result =
m_model->predict({inputFdeep});
68 std::map<int, double> probabilities;
70 const int outputIndex = (*m_pidNeuralNetworkParametersDB)->pdg2OutputIndex(pdgCode);
71 probabilities[pdgCode] = result.front().get(fdeep::tensor_pos(outputIndex));
const std::vector< int > & getOutputSpeciesPdg() const
Get the list of pdg codes of species hypotheses, for which the network predicts the probability in th...
std::unique_ptr< const fdeep::model > m_model
frugally-deep neural network