xgboost

probability_distribution.h
Go to the documentation of this file.
1
8 #ifndef XGBOOST_COMMON_PROBABILITY_DISTRIBUTION_H_
9 #define XGBOOST_COMMON_PROBABILITY_DISTRIBUTION_H_
10
11 namespace xgboost {
12 namespace common {
13
14 namespace probability_constant {
15
17 const double kPI = 3.14159265358979323846;
19 const double kEulerMascheroni = 0.57721566490153286060651209008240243104215933593992;
20
21 } // namespace probability_constant
22
24 enum class ProbabilityDistributionType : int {
25 kNormal = 0, kLogistic = 1, kExtreme = 2
26 };
27
29 class ProbabilityDistribution {
30 public:
36 virtual double PDF(double z) = 0;
42 virtual double CDF(double z) = 0;
48 virtual double GradPDF(double z) = 0;
54 virtual double HessPDF(double z) = 0;
55
61 static ProbabilityDistribution* Create(ProbabilityDistributionType dist);
62 virtual ~ProbabilityDistribution() = default;
63 };
64
66 class NormalDist : public ProbabilityDistribution {
67 public:
68 double PDF(double z) override;
69 double CDF(double z) override;
70 double GradPDF(double z) override;
71 double HessPDF(double z) override;
72 };
73
75 class LogisticDist : public ProbabilityDistribution {
76 public:
77 double PDF(double z) override;
78 double CDF(double z) override;
79 double GradPDF(double z) override;
80 double HessPDF(double z) override;
81 };
82
84 class ExtremeDist : public ProbabilityDistribution {
85 public:
86 double PDF(double z) override;
87 double CDF(double z) override;
88 double GradPDF(double z) override;
89 double HessPDF(double z) override;
90 };
91
92 } // namespace common
93 } // namespace xgboost
94
95 #endif // XGBOOST_COMMON_PROBABILITY_DISTRIBUTION_H_
xgboost::common::probability_constant::kEulerMascheroni
const double kEulerMascheroni
The Euler-Mascheroni_constant.
Definition: probability_distribution.h:19
xgboost::common::ProbabilityDistributionType::kLogistic
xgboost::common::probability_constant::kPI
const double kPI
Constant PI.
Definition: probability_distribution.h:17
xgboost::common::ProbabilityDistributionType::kNormal
xgboost::common::ProbabilityDistribution
Interface for a probability distribution.
Definition: probability_distribution.h:29
xgboost::common::ProbabilityDistributionType::kExtreme
xgboost::common::ProbabilityDistributionType
ProbabilityDistributionType
Enum encoding possible choices of probability distribution.
Definition: probability_distribution.h:24
xgboost::common::NormalDist
The (standard) normal distribution.
Definition: probability_distribution.h:66
xgboost
namespace of xgboost
Definition: base.h:102
xgboost::common::LogisticDist
The (standard) logistic distribution.
Definition: probability_distribution.h:75
xgboost::common::ExtremeDist
The extreme distribution, also known as the Gumbel (minimum) distribution.
Definition: probability_distribution.h:84