Skip to content

Commit 160d0ae

Browse files
authored
Improve docstrings new alpha and beta parameters (#95)
* improve docstrings * improve docstrings * correct latex * fix pylint * fix latex ...again... plus add feedback
1 parent 399976b commit 160d0ae

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

pymc_bart/bart.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def rng_fn(
6565

6666

6767
class BART(Distribution):
68-
"""
68+
r"""
6969
Bayesian Additive Regression Tree distribution.
7070
7171
Distribution representing a sum over trees
@@ -77,17 +77,26 @@ class BART(Distribution):
7777
Y : TensorLike
7878
The response vector.
7979
m : int
80-
Number of trees
80+
Number of trees.
8181
response : str
8282
How the leaf_node values are computed. Available options are ``constant``, ``linear`` or
8383
``mix``. Defaults to ``constant``.
8484
alpha : float
85-
Control the prior probability over the depth of the trees. Even when it can takes values in
86-
the interval (0, 1), it is recommended to be in the interval (0, 0.5].
85+
Controls the prior probability over the depth of the trees.
86+
Should be in the (0, 1) interval.
87+
beta : float
88+
Controls the prior probability over the number of leaves of the trees.
89+
Should be positive.
8790
split_prior : Optional[List[float]], default None.
8891
Each element of split_prior should be in the [0, 1] interval and the elements should sum to
8992
1. Otherwise they will be normalized.
9093
Defaults to 0, i.e. all covariates have the same prior probability to be selected.
94+
95+
Notes
96+
-----
97+
The parameters ``alpha`` and ``beta`` parametrize the probability that a node at
98+
depth :math:`d \: (= 0, 1, 2,...)` is non-terminal, given by :math:`\alpha(1 + d)^{-\beta}`.
99+
The default values are :math:`\alpha = 0.95` and :math:`\beta = 2`.
91100
"""
92101

93102
def __new__(
@@ -97,7 +106,7 @@ def __new__(
97106
Y: TensorLike,
98107
m: int = 50,
99108
alpha: float = 0.95,
100-
beta: float = 2,
109+
beta: float = 2.0,
101110
response: str = "constant",
102111
split_prior: Optional[List[float]] = None,
103112
**kwargs,

0 commit comments

Comments
 (0)