Treelite
xgboost.h
Go to the documentation of this file.
1 
7 #ifndef TREELITE_FRONTEND_XGBOOST_XGBOOST_H_
8 #define TREELITE_FRONTEND_XGBOOST_XGBOOST_H_
9 
10 #include <string>
11 #include <vector>
12 #include <cmath>
13 
14 namespace treelite {
15 
16 struct ModelParam; // forward declaration
17 
18 namespace details {
19 namespace xgboost {
20 
21 struct ProbToMargin {
22  static float Sigmoid(float global_bias) {
23  return -logf(1.0f / global_bias - 1.0f);
24  }
25  static float Exponential(float global_bias) {
26  return logf(global_bias);
27  }
28 };
29 
30 extern const std::vector<std::string> exponential_objectives;
31 
32 // set correct prediction transform function, depending on objective function
33 void SetPredTransform(const std::string& objective_name, ModelParam* param);
34 
35 // Transform the global bias parameter from probability into margin score
36 void TransformGlobalBiasToMargin(ModelParam* param);
37 
38 enum FeatureType {
39  kNumerical = 0,
40  kCategorical = 1
41 };
42 
43 } // namespace xgboost
44 } // namespace details
45 } // namespace treelite
46 #endif // TREELITE_FRONTEND_XGBOOST_XGBOOST_H_