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
15class TreeliteModelBase;
16
18 public:
19
20 CompiledModelInterface(int nbatch);
21
23
24 // Get number of features in model
25 int GetNumFeatures();
26
27 void ModelWarmUp(Entry *input);
28
29 // Run prediction with GBDT
30 void Predict(Entry *input, float *result);
31
32 // Is it a neutrino or cosmic according to GBDT?
33 bool Classify(const float *result, float &bdt_threshold);
34
35 protected:
36
37 std::unique_ptr<TreeliteModelBase> model_ptr;
39
40};
41} // triggeralgs
42
43#endif // TRIGGERALGS_COMPILEDMODELINTERFACE_HPP_
bool Classify(const float *result, float &bdt_threshold)
void Predict(Entry *input, float *result)
std::unique_ptr< TreeliteModelBase > model_ptr