Apply this expert onto a dataset.
103 {
104 if ((m_general_options.m_nClasses != m_specific_options.m_multiple_output.size()) and (not m_specific_options.m_passthrough)) {
105 B2ERROR("The number of classes declared in the general options do not match the number of outputs declared in the specific options for the Trivial expert");
106 }
107
108 if (m_specific_options.m_passthrough) {
109 if ((m_general_options.m_variables.size() != 1) and (m_general_options.m_variables.size() != m_general_options.m_nClasses)) {
110 B2ERROR("Trivial method in passthrough mode requires either exactly one input variable or one per class, matching the number of classes declared in the general options. Found "
111 << m_general_options.m_variables.size());
112 }
113 }
114
115 std::vector<std::vector<float>> probabilities(test_data.getNumberOfEvents(), std::vector<float>(m_general_options.m_nClasses));
116 for (unsigned int iEvent = 0; iEvent < test_data.getNumberOfEvents(); ++iEvent) {
117 test_data.loadEvent(iEvent);
118 for (unsigned int iClass = 0; iClass < m_general_options.m_nClasses; ++iClass) {
119 if (m_specific_options.m_passthrough) {
120 if (m_general_options.m_variables.size() == 1) {
121 probabilities[iEvent][iClass] = test_data.m_input[0];
122 } else {
123 probabilities[iEvent][iClass] = test_data.m_input[iClass];
124 }
125 } else {
126 probabilities[iEvent][iClass] = m_specific_options.m_multiple_output.at(iClass);
127 }
128 }
129 }
130 return probabilities;
131 }