Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@ cython_debug/

**.csv
tests/test_hmc.py
tests/bench_bart.py
4 changes: 1 addition & 3 deletions pymc_bart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# If removed, the PGBART step method will not be detected by PyMC.
import bartrs # registers PGBART with PyMC.
import bartrs

# Fix precommit complaining about unused import
if bartrs:
pass

Expand Down
16 changes: 11 additions & 5 deletions pymc_bart/pymc_bart.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
try:
from bartrs.bartrs import PyBartSettings, PySampler, TreeArrays
from bartrs.bartrs import PosteriorSampler, PyBartSettings, PySampler, TreeArrays
except Exception as e:
print(f"Warning: Could not import PyBartSettings, PySampler, or TreeArrays due to: {e}")
PyBartSettings = PySampler = TreeArrays = None
print(
f"Warning: Could not import PyBartSettings, PySampler, TreeArrays, or PosteriorSampler due to: {e}"
)
PyBartSettings = PySampler = TreeArrays = PosteriorSampler = None

for cls in (PyBartSettings, PySampler, TreeArrays):
for cls in (PyBartSettings, PySampler, TreeArrays, PosteriorSampler):
if cls is not None:
cls.__module__ = "pymc_bart.pymc_bart"

__all__ = [name for name in ("PyBartSettings", "PySampler", "TreeArrays") if globals().get(name)]
__all__ = [
name
for name in ("PyBartSettings", "PySampler", "TreeArrays", "PosteriorSampler")
if globals().get(name)
]
Loading
Loading