Skip to content

Commit aedee25

Browse files
authored
improve docstrings (#103)
* improve docstrings * move chipman reference
1 parent c8997c3 commit aedee25

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

docs/api_reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ methods in the current release of PyMC-BART.
1313
=============================
1414

1515
.. automodule:: pymc_bart
16-
:members: BART, PGBART, plot_pdp, plot_variable_importance, plot_convergence
16+
:members: BART, PGBART, plot_pdp, plot_variable_importance, plot_convergence, ContinuousSplitRule, OneHotSplitRule, SubsetSplitRule

pymc_bart/bart.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from multiprocessing import Manager
1818
from typing import List, Optional, Tuple
19+
import warnings
1920

2021
import numpy as np
2122
import numpy.typing as npt
@@ -81,7 +82,7 @@ class BART(Distribution):
8182
Number of trees.
8283
response : str
8384
How the leaf_node values are computed. Available options are ``constant``, ``linear`` or
84-
``mix``. Defaults to ``constant``.
85+
``mix``. Defaults to ``constant``. Options ``linear`` and ``mix`` are still experimental.
8586
alpha : float
8687
Controls the prior probability over the depth of the trees.
8788
Should be in the (0, 1) interval.
@@ -111,6 +112,9 @@ class BART(Distribution):
111112
The parameters ``alpha`` and ``beta`` parametrize the probability that a node at
112113
depth :math:`d \: (= 0, 1, 2,...)` is non-terminal, given by :math:`\alpha(1 + d)^{-\beta}`.
113114
The default values are :math:`\alpha = 0.95` and :math:`\beta = 2`.
115+
116+
This is the recommend prior by Chipman Et al. BART: Bayesian additive regression trees,
117+
`link <https://doi.org/10.1214/09-AOAS285>`__
114118
"""
115119

116120
def __new__(
@@ -127,6 +131,11 @@ def __new__(
127131
separate_trees: Optional[bool] = False,
128132
**kwargs,
129133
):
134+
if response in ["linear", "mix"]:
135+
warnings.warn(
136+
"Options linear and mix are experimental and still not well tested\n"
137+
+ "Use with caution."
138+
)
130139
manager = Manager()
131140
cls.all_trees = manager.list()
132141

pymc_bart/pgbart.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ def competence(var, has_grad):
381381

382382

383383
class RunningSd:
384+
"""Welford's online algorithm for computing the variance/standard deviation"""
385+
384386
def __init__(self, shape: tuple) -> None:
385387
self.count = 0 # number of data points
386388
self.mean = np.zeros(shape) # running mean

0 commit comments

Comments
 (0)