StochTree 0.5.0.9000
Loading...
Searching...
No Matches
prior.h
1
5#ifndef STOCHTREE_PRIOR_H_
6#define STOCHTREE_PRIOR_H_
7
8#include <Eigen/Dense>
9#include <stochtree/log.h>
10
11namespace StochTree {
12
13class RandomEffectsGaussianPrior {
14 public:
15 RandomEffectsGaussianPrior() {}
16 virtual ~RandomEffectsGaussianPrior() = default;
17};
18
19class RandomEffectsRegressionGaussianPrior : public RandomEffectsGaussianPrior {
20 public:
21 RandomEffectsRegressionGaussianPrior(double a, double b, int32_t num_components, int32_t num_groups) {
22 a_ = a;
23 b_ = b;
24 num_components_ = num_components;
25 num_groups_ = num_groups;
26 }
27 ~RandomEffectsRegressionGaussianPrior() {}
28 double GetPriorVarianceShape() { return a_; }
29 double GetPriorVarianceScale() { return b_; }
30 int32_t GetNumComponents() { return num_components_; }
31 int32_t GetNumGroups() { return num_groups_; }
32 void SetPriorVarianceShape(double a) { a_ = a; }
33 void SetPriorVarianceScale(double b) { b_ = b; }
34 void SetNumComponents(int32_t num_components) { num_components_ = num_components; }
35 void SetNumGroups(int32_t num_groups) { num_groups_ = num_groups; }
36
37 private:
38 double a_;
39 double b_;
40 int32_t num_components_;
41 int32_t num_groups_;
42};
43
44class TreePrior {
45 public:
46 TreePrior(double alpha, double beta, int32_t min_samples_in_leaf, int32_t max_depth = -1) {
47 alpha_ = alpha;
48 beta_ = beta;
49 min_samples_in_leaf_ = min_samples_in_leaf;
50 max_depth_ = max_depth;
51 }
52 ~TreePrior() {}
53 double GetAlpha() { return alpha_; }
54 double GetBeta() { return beta_; }
55 int32_t GetMinSamplesLeaf() { return min_samples_in_leaf_; }
56 int32_t GetMaxDepth() { return max_depth_; }
57 void SetAlpha(double alpha) { alpha_ = alpha; }
58 void SetBeta(double beta) { beta_ = beta; }
59 void SetMinSamplesLeaf(int32_t min_samples_in_leaf) { min_samples_in_leaf_ = min_samples_in_leaf; }
60 void SetMaxDepth(int32_t max_depth) { max_depth_ = max_depth; }
61
62 private:
63 double alpha_;
64 double beta_;
65 int32_t min_samples_in_leaf_;
66 int32_t max_depth_;
67};
68
69class IGVariancePrior {
70 public:
71 IGVariancePrior(double shape, double scale) {
72 shape_ = shape;
73 scale_ = scale;
74 }
75 ~IGVariancePrior() {}
76 double GetShape() { return shape_; }
77 double GetScale() { return scale_; }
78 void SetShape(double shape) { shape_ = shape; }
79 void SetScale(double scale) { scale_ = scale; }
80
81 private:
82 double shape_;
83 double scale_;
84};
85
86} // namespace StochTree
87
88#endif // STOCHTREE_PRIOR_H_
A collection of random number generation utilities.
Definition bart.h:15