DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
triggeralgs
include
triggeralgs
ProtoDUNEBSMWindow
CompiledModelInterface.hpp
Go to the documentation of this file.
1
#ifndef TRIGGERALGS_COMPILEDMODELINTERFACE_HPP_
2
#define TRIGGERALGS_COMPILEDMODELINTERFACE_HPP_
3
4
#include "
triggeralgs/ProtoDUNEBSMWindow/treelitemodel.hpp
"
5
#include <string>
6
#include <fstream>
7
#include <algorithm>
8
9
namespace
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
15
class
TreeliteModelBase
;
16
17
class
CompiledModelInterface
{
18
public
:
19
20
CompiledModelInterface
(
int
nbatch);
21
22
~CompiledModelInterface
();
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
;
38
int
num_batch
;
39
40
};
41
}
// triggeralgs
42
43
#endif
// TRIGGERALGS_COMPILEDMODELINTERFACE_HPP_
triggeralgs::CompiledModelInterface::Classify
bool Classify(const float *result, float &bdt_threshold)
Definition
CompiledModelInterface.cpp:33
triggeralgs::CompiledModelInterface::Predict
void Predict(Entry *input, float *result)
Definition
CompiledModelInterface.cpp:27
triggeralgs::CompiledModelInterface::GetNumFeatures
int GetNumFeatures()
Definition
CompiledModelInterface.cpp:13
triggeralgs::CompiledModelInterface::num_batch
int num_batch
Definition
CompiledModelInterface.hpp:38
triggeralgs::CompiledModelInterface::model_ptr
std::unique_ptr< TreeliteModelBase > model_ptr
Definition
CompiledModelInterface.hpp:37
triggeralgs::CompiledModelInterface::ModelWarmUp
void ModelWarmUp(Entry *input)
Definition
CompiledModelInterface.cpp:17
triggeralgs::CompiledModelInterface::CompiledModelInterface
CompiledModelInterface(int nbatch)
Definition
CompiledModelInterface.cpp:7
triggeralgs::CompiledModelInterface::~CompiledModelInterface
~CompiledModelInterface()
Definition
CompiledModelInterface.cpp:11
triggeralgs::TreeliteModelBase
Base class: defines shared interface and utilities for all models.
Definition
treelitemodel.hpp:27
triggeralgs
Definition
AbstractFactory.hpp:18
treelitemodel.hpp
triggeralgs::Entry
Definition
treelitemodel.hpp:20
Generated on
for DUNE-DAQ by
1.17.0