Treelite
Typedefs | Enumerations | Functions | Variables
base.h File Reference

defines configuration macros of Treelite More...

#include <cstdint>
#include <typeinfo>
#include <string>
#include <unordered_map>
#include <stdexcept>
#include "./typeinfo.h"
Include dependency graph for base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef float tl_float
 float type to be used internally
 

Enumerations

enum  SplitFeatureType : int8_t { kNone, kNumerical, kCategorical }
 feature split type
 
enum  Operator : int8_t {
  kNone, kEQ, kLT, kLE,
  kGT, kGE
}
 comparison operators
 

Functions

std::string OpName (Operator op)
 get string representation of comparison operator More...
 
std::string SplitFeatureTypeName (SplitFeatureType type)
 Get string representation of split type. More...
 
template<typename ElementType , typename ThresholdType >
bool CompareWithOp (ElementType lhs, Operator op, ThresholdType rhs)
 perform comparison between two float's using a comparsion operator The comparison will be in the form [lhs] [op] [rhs]. More...
 

Variables

const std::unordered_map< std::string, Operator > optable
 conversion table from string to Operator, defined in tables.cc More...
 

Detailed Description

defines configuration macros of Treelite

Copyright (c) 2017-2020 by Contributors

Author
Hyunsu Cho

Definition in file base.h.

Function Documentation

◆ CompareWithOp()

bool treelite::CompareWithOp ( ElementType  lhs,
Operator  op,
ThresholdType  rhs 
)
inline

perform comparison between two float's using a comparsion operator The comparison will be in the form [lhs] [op] [rhs].

Parameters
lhsfloat on the left hand side
opcomparison operator
rhsfloat on the right hand side
Returns
whether [lhs] [op] [rhs] is true or not

Definition at line 77 of file base.h.

◆ OpName()

std::string treelite::OpName ( Operator  op)
inline

get string representation of comparison operator

Parameters
opcomparison operator
Returns
string representation

Definition at line 43 of file base.h.

◆ SplitFeatureTypeName()

std::string treelite::SplitFeatureTypeName ( SplitFeatureType  type)
inline

Get string representation of split type.

Parameters
typeType of a split
Returns
String representation

Definition at line 59 of file base.h.

Variable Documentation

◆ optable

const std::unordered_map< std::string, Operator > optable
Initial value:
{
{"==", Operator::kEQ},
{"<", Operator::kLT},
{"<=", Operator::kLE},
{">", Operator::kGT},
{">=", Operator::kGE}
}

conversion table from string to Operator, defined in tables.cc

Definition at line 14 of file optable.cc.