DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
CompiledModelInterface.hpp
Go to the documentation of this file.
1#ifndef TRIGGERALGS_COMPILEDMODELINTERFACE_HPP_
2#define TRIGGERALGS_COMPILEDMODELINTERFACE_HPP_
3
5#include <string>
6#include <fstream>
7#include <algorithm>
8
9namespace triggeralgs {
10
11// Interface for deploying XGBoost model using compiled C-code
12// XGBoost model converted to treelite and then converted to c-code
13
14// Foward declare base class for the treelite model
16
18 public:
19
20 CompiledModelInterface(int nbatch, bool is_pdvd);
21
23
24 // Get number of features in model
25 int GetNumFeatures();
26
27 // Run prediction with GBDT
28 void Predict(Entry *input, float *result);
29
30 // Is it a neutrino or cosmic according to GBDT?
31 bool Classify(const float *result, float bdt_threshold);
32
33 protected:
34
35 std::unique_ptr<TreeliteModelBase> model_ptr;
37
38};
39} // triggeralgs
40
41#endif // TRIGGERALGS_COMPILEDMODELINTERFACE_HPP_
void Predict(Entry *input, float *result)
std::unique_ptr< TreeliteModelBase > model_ptr
bool Classify(const float *result, float bdt_threshold)
CompiledModelInterface(int nbatch, bool is_pdvd)
Base class: defines shared interface and utilities for all models.