7 #ifndef TREELITE_BASE_H_ 8 #define TREELITE_BASE_H_ 13 #include <unordered_map> 23 kNone, kNumerical, kCategorical
36 extern const std::unordered_map<std::string, Operator>
optable;
45 case Operator::kEQ:
return "==";
46 case Operator::kLT:
return "<";
47 case Operator::kLE:
return "<=";
48 case Operator::kGT:
return ">";
49 case Operator::kGE:
return ">=";
61 case SplitFeatureType::kNone:
return "none";
62 case SplitFeatureType::kNumerical:
return "numerical";
63 case SplitFeatureType::kCategorical:
return "categorical";
76 template <
typename ElementType,
typename ThresholdType>
79 case Operator::kEQ:
return lhs == rhs;
80 case Operator::kLT:
return lhs < rhs;
81 case Operator::kLE:
return lhs <= rhs;
82 case Operator::kGT:
return lhs > rhs;
83 case Operator::kGE:
return lhs >= rhs;
85 throw std::runtime_error(
"operator undefined");
92 #endif // TREELITE_BASE_H_ SplitFeatureType
feature split type
float tl_float
float type to be used internally
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...
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