7 #ifndef TREELITE_BASE_H_ 8 #define TREELITE_BASE_H_ 15 #include <unordered_map> 24 kNone, kNumerical, kCategorical
37 extern const std::unordered_map<std::string, Operator>
optable;
46 case Operator::kEQ:
return "==";
47 case Operator::kLT:
return "<";
48 case Operator::kLE:
return "<=";
49 case Operator::kGT:
return ">";
50 case Operator::kGE:
return ">=";
62 case SplitFeatureType::kNone:
return "none";
63 case SplitFeatureType::kNumerical:
return "numerical";
64 case SplitFeatureType::kCategorical:
return "categorical";
77 template <
typename ElementType,
typename ThresholdType>
80 case Operator::kEQ:
return lhs == rhs;
81 case Operator::kLT:
return lhs < rhs;
82 case Operator::kLE:
return lhs <= rhs;
83 case Operator::kGT:
return lhs > rhs;
84 case Operator::kGE:
return lhs >= rhs;
86 throw Error(
"operator undefined");
93 #endif // TREELITE_BASE_H_ SplitFeatureType
feature split type
float tl_float
float type to be used internally
Exception class that will be thrown by Treelite.
std::string OpName(Operator op)
get string representation of comparison operator
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...
Exception class used throughout the Treelite codebase.
Defines TypeInfo class and utilities.
std::string SplitFeatureTypeName(SplitFeatureType type)
Get string representation of split type.
const std::unordered_map< std::string, Operator > optable
conversion table from string to Operator, defined in tables.cc
Operator
comparison operators