DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
triggeralgs::CompiledModelInterface Class Reference

#include <CompiledModelInterface.hpp>

Public Member Functions

 CompiledModelInterface (int nbatch, bool is_pdvd)
 ~CompiledModelInterface ()
int GetNumFeatures ()
void Predict (Entry *input, float *result)
bool Classify (const float *result, float bdt_threshold)

Protected Attributes

std::unique_ptr< TreeliteModelBasemodel_ptr
int num_batch

Detailed Description

Definition at line 17 of file CompiledModelInterface.hpp.

Constructor & Destructor Documentation

◆ CompiledModelInterface()

triggeralgs::CompiledModelInterface::CompiledModelInterface ( int nbatch,
bool is_pdvd )

Definition at line 7 of file CompiledModelInterface.cpp.

7 : num_batch(nbatch) {
8 if (is_pdvd) {
9 model_ptr = std::make_unique<TreelitePDVDModel>();
10 } else {
11 model_ptr = std::make_unique<TreelitePDHDModel>();
12 }
13}
std::unique_ptr< TreeliteModelBase > model_ptr

◆ ~CompiledModelInterface()

triggeralgs::CompiledModelInterface::~CompiledModelInterface ( )

Definition at line 15 of file CompiledModelInterface.cpp.

15{}

Member Function Documentation

◆ Classify()

bool triggeralgs::CompiledModelInterface::Classify ( const float * result,
float bdt_threshold )

Definition at line 27 of file CompiledModelInterface.cpp.

27 {
28 for (uint64_t rid = 0; rid < num_batch; rid++) {
29 if (result[rid] > bdt_threshold) {
30 return true;
31 }
32 }
33 return false;
34}

◆ GetNumFeatures()

int triggeralgs::CompiledModelInterface::GetNumFeatures ( )

Definition at line 17 of file CompiledModelInterface.cpp.

17 {
18 return model_ptr->get_num_feature();
19}

◆ Predict()

void triggeralgs::CompiledModelInterface::Predict ( Entry * input,
float * result )

Definition at line 21 of file CompiledModelInterface.cpp.

21 {
22 for (int rid = 0; rid < num_batch; ++rid) {
23 model_ptr->predict(input, 0, result);
24 }
25}

Member Data Documentation

◆ model_ptr

std::unique_ptr<TreeliteModelBase> triggeralgs::CompiledModelInterface::model_ptr
protected

Definition at line 35 of file CompiledModelInterface.hpp.

◆ num_batch

int triggeralgs::CompiledModelInterface::num_batch
protected

Definition at line 36 of file CompiledModelInterface.hpp.


The documentation for this class was generated from the following files: