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
14 public:
16 virtual ~RandomEffectsGaussianPrior() = default;
17};
18
20 public:
22 a_ = a;
23 b_ = b;
24 num_components_ = num_components;
25 num_groups_ = num_groups;
26 }
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:
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
70 public:
71 IGVariancePrior(double shape, double scale) {
72 shape_ = shape;
73 scale_ = scale;
74 }
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_
Definition prior.h:69
Definition prior.h:44
static void GFRSampleOneIter(TreeEnsemble &active_forest, ForestTracker &tracker, ForestContainer &forests, LeafModel &leaf_model, ForestDataset &dataset, ColumnVector &residual, TreePrior &tree_prior, std::mt19937 &gen, std::vector< double > &variable_weights, std::vector< int > &sweep_update_indices, double global_variance, std::vector< FeatureType > &feature_types, int cutpoint_grid_size, bool keep_forest, bool pre_initialized, bool backfitting, int num_features_subsample, int num_threads, LeafSuffStatConstructorArgs &... leaf_suff_stat_args)
Definition tree_sampler.h:816
A collection of random number generation utilities.
Definition bart.h:15