DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
treelitemodel.cpp
Go to the documentation of this file.
2
3namespace triggeralgs {
4
5// Implement functions of TreeliteModelBase base class
6// that are common to all compiled GBDT models
7
8const int32_t TreeliteModelBase::num_class[1] = { 1 };
9
10TreeliteModelBase::TreeliteModelBase(int numTargets, int maxNumClass)
11 : N_TARGET(numTargets), MAX_N_CLASS(maxNumClass) {}
12
14 return N_TARGET;
15}
16
17void TreeliteModelBase::get_num_class(int32_t* out) const {
18 for (int i = 0; i < N_TARGET; ++i) {
20 }
21}
22
24 return "float32";
25}
27 return "float32";
28}
30void TreeliteModelBase::postprocess(float* result) const {
31 // sigmoid
32 const float alpha = (float)1;
33 for (size_t i = 0; i < N_TARGET * MAX_N_CLASS; ++i) {
34 result[i] = (float)(1) / ((float)(1) + expf(-alpha * result[i]));
35 }
36}
37
38} // end namespace triggeralgs
virtual void postprocess(float *result) const
void get_num_class(int32_t *out) const
TreeliteModelBase(int numTargets=1, int maxNumClass=1)
virtual const char * get_threshold_type() const
virtual const char * get_leaf_output_type() const
static const int32_t num_class[1]