Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
188 changes: 52 additions & 136 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,142 +1,58 @@
# Open Bayesian Trees Project
This repository includes new developments with Bayesian Additive Regression Trees and extends the original OpenBT repository created by Matt Pratola (https://bitbucket.org/mpratola/openbt/src/master/).
Such extensions include Bayesian Model Mixing and Bayesian Calibration.
All of the Bayesian Tree code is written in C++. User interfaces constructed in R and Python allow one to easily run the software.
The BART Model Mixing software has been implemented in the [Taweret](https://github.com/bandframework/Taweret/tree/main) Python package in conjunction with the [BAND](https://bandframework.github.io/) collaboration.


# Installation
The heart of OpenBT is a set of C++ tools that can be used directly via
the command line or indirectly through the Python and R packages, which wrap
them. Typically these tools are built with an implementation of the Message
Passing Interface (MPI) such as [Open MPI](https://www.open-mpi.org) or
[MPICH](https://www.mpich.org) to enable distributed parallelization of
computations. In particular, the Python wrapper package is always built with
MPI support.

The software and its distribution scheme have been developed to allow users to
use OpenBT with the MPI installation of their choice. For instance, it
can be built with MPI installations on leadership class platforms and clusters
that were installed by experts and optimized for their specific platform. As a
result, however, the software is not distributed as prebuilt binaries or wheels,
but rather must be built for each case with the compiler suite and matching MPI
implementation provided by the user.

## Requirements
Before building and installing the Python package, users
must provide
* a compiler suite that includes a C++ compiler that supports the C++14
standard,
* an MPI installation that is compatible with the compiler suite, and
* optionally the [Eigen software package](https://gitlab.com/libeigen/eigen).

Note that if installing MPI using a package manager, related developer library
packages such as ``libopenmpi-dev`` or ``libmpich-dev`` might need to be
installed in addition to the base MPI packages such as ``openmpi-bin`` or
``mpich``.

To build and install just the bare C++ tools, users must provide in addition to
the above
* the [Meson build system](https://mesonbuild.com) and its prerequisites such as
Python 3 and [ninja](https://ninja-build.org).

While both Meson and ninja are used internally to build the Python package, they
are installed automatically just for building the package.

The Meson build system is setup to automatically detect the compiler suite and
MPI installation to use. If Eigen already exists in the system and Meson can
find it, then Meson will use it for the build. Otherwise, Meson will
automatically obtain a copy of Eigen for internal use.

We presently test OpenBT with both Open MPI and MPICH. In addition, we
have successfully tested with the Intel MPI implementation and have used the
Python package with MPI implementations installed
* via package managers such as Ubuntu's Advanced Packaging Tool (`apt`) and
[homebrew](https://brew.sh) on macOS;
* by experts on clusters and that are available as modules; and
* with `conda` from the prebuilt conda forge
[openmpi](https://anaconda.org/conda-forge/openmpi) package.

## Meson installation
The Meson build system documentation suggests installing Meson via package
manager when possible. Please refer to that documentation for detailed and
up-to-date installation information.

If Meson cannot be installed by package manager or the manager's version is too
old, the following is contrary to Meson suggestions but has been used
successfully to install Meson with Python into a dedicated virtual environment
as well as to install `meson` in the `PATH` for use without needing to activate
that virtual environment.
```
$ /path/to/target/python -m venv ~/local/venv/meson
$ . ~/local/venv/meson/bin/activate
$ which python
$ python -m pip install --upgrade pip
$ python -m pip install meson
$ python -m pip list
$ ln -s ~/local/venv/meson/bin/meson ~/local/bin
<add ~/local/bin to PATH if desired and appropriate>
$ deactivate
$ which meson
$ meson --version
```
Note that this `meson` virtual environment is for installing **just** the Meson
build system. Attempts to install `openbt` into this virtual environment
will likely fail with an error that the `mesonbuild` module cannot be found.

## Python package
The OpenBT Python package is **not** currently distributed on PyPI since the
[PyPI OpenBT package](https://pypi.org/project/openbt/) already exists. This
package will eventually be transferred to this project so that distribution of
modern versions of this package will be enabled by PyPI under the name `openbt`.

<!--
The OpenBTMixing Python package is distributed on
[PyPI](https://pypi.org/project/openbtmixing/) as a source distribution that
contains the C++ code and files needed by Meson to build the dedicated,
standalone command line tools that the package will use. The tools are built
and installed automatically by Meson as part of executing
```
python -m pip install openbt
```
By default, `pip install` does not show any of Meson's progress. Users and
developers interested in seeing how Meson satisfies dependencies and reviewing
compiler output should pass `-v` to `pip install`.
-->
# OpenBT

Instead the package should be built and installed from a clone of this repository with
```
$ cd /path/to/OpenBT/openbt_pypkg
$ python -m pip install .
```
Developers can install in developer/editable mode with verbose logging of the
build process and installation with
```
$ cd /path/to/OpenBT/openbt_pypkg
$ python -m pip install -v -e .
```
In this latter case, the command line tools are built automatically and
installed at `/path/to/OpenBT/openbt_pypkg/src/openbt/bin`. The
Python package is hardcoded to use those tools so that the existence of another
set of tools in the system and in `PATH` should not cause issues.
TODO: Copy info from landing page of sphinx docs here.

OpenBT package installations can be minimally tested with
```
$ python
>>> import openbt
>>> openbt.__version__
'<version>'
>>> openbt.test()
```
### Repository
TODO: Add general badges

### Python
TODO: Add Python-specific badges

## License & Copyright

## C++ library & command line tool interface
Developers and C++ users can directly build and install the command line tools,
an OpenBT library, and library tests with `tools/build_openbt_clt.sh`.
Note that these do **not** need to be built in order to use the Python package.
TODO: Copy license & copyright info from landing page of sphinx docs here

## R package
**TODO**: Needs to be written based on current state of affairs.
## Support

# Examples
To

The examples from the article "Model Mixing Using Bayesian Additive Regression Trees" are reproduced in the jupyter notebook BART_BMM_Technometrics.ipynb. This notebook can be run locally or in a virtual environment such as google colab.
* report potential problems with OpenBT or any of the packages derived from it,
* propose a change, or
* request a new feature,

please check if a related [Issue](https://github.com/bandframework/OpenBT/issues)
already exists before creating a new issue. For all other communication, please
send an email to the OpenBT development team

* TODO: Matt's contact info
* TODO: John's contact info

## Documentation

[User and Developer Guides](https://openbt.readthedocs.io) are hosted on
ReadTheDocs. Please refer to those documents for information regarding
examples.

## Installation & Testing

Refer to the getting started sections in the User Guide related to the tool or
package that you intend to use.

## Contributing to IBCDFO

Contributions are welcome in a variety of forms; see
[Contributing](https://openbt.readthedocs.io/en/latest/contributing.html) in the
Developer Guide.

## Cite OpenBT

```
@techreport{openbt2026,
author = {Matt Pratola and John Yannotty},
title = {{OpenBT 1.2.0} Users Manual},
institution = {TBD},
number = {Version 1.2.0},
year = {2026},
url = {https://openbt.readthedocs.io/}
}
```
4 changes: 3 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ Contributing
General Information
-------------------
.. todo::

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to remove .. todo:: now so that this official text is not rendered inside a TODO block.
https://openbt--39.org.readthedocs.build/en/39/contributing.html

Some projects also provide information to potential contributors about what it means to contribute to the project. Some examples
https://github.com/bandframework/Taweret?tab=contributing-ov-file
https://surmise.readthedocs.io/en/latest/contributing.html#developer-s-certificate-of-origin-1-1

Sarthak to write this
The Open Bayesian Trees (OpenBT) project evolved from an initial C + MPI codebase written from scrach in 2010 through two subsequent ground-up rewrites culminating in the current C++ codebase with R and Python wrappers. Matthew T. Pratola (mpratola@iu.edu) has served as the primary author and architect for OpenBT. Akira Horiguchi (ahoriguchi@ucdavis.edu) made contributions with Sobol sensitivity indices and Shapley indices as well as Pareto front-based multiobjective optimization. John Yannotty (jcyannotty@gmail.com) contributed BART-based model mixing, the Random Path BART (RPBART) model and RPBART-based model mixing as well as Python wrapper code. Robert McCulloch (robert.mcculloch@asu.edu) made contributions in the early days with the random number generators and log gamma approximation. Clark van Lieshout (clarkvan33@gmail.com) contributed Python wrapper code.

The current repo, now housed within the wider BAND project, becomes the long-term home for OpenBT.
20 changes: 14 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
.. _Open MPI: https://www.open-mpi.org
.. _MPICH: https://www.mpich.org
.. _framework: https://bandframework.github.io
.. _Issue 35: https://github.com/bandframework/OpenBT/issues/35
.. _OpenBT repository: https://bitbucket.org/mpratola/openbt/src/master
.. _OpenBTMixing repository: https://github.com/jcyannotty/OpenBT

.. todo::

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to handle this TODO as part of this PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you want for 'responsibilities of user'?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some people like to add an explicit statement about how the code is offered as is and with no guarantees. It's up to the user to determine how to use the software and if the results generated are correct for their purposes. Sometimes this might be referred to as a disclaimer.
https://pages.nist.gov/circular-economy-manufacturing-models/disclaimer.html

You already have something to this effect in the LICENSE.

You will see me add in statements to this effect where I don't want to give people the impression, for example, that just because the test suite is passing that everything must be 100% correct.
https://openbt.readthedocs.io/en/latest/get_started_py.html#testing

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few more things along contributing etc and removed the todo.

Write high-level description, explain development history, and motivate
breakdown of documents presented here. License, copyright, responsibilities
of user, etc.
Matt to write high-level description and motivate breakdown of documents
presented here. License, copyright, responsibilities of user, etc.

The heart of |openbt| is a set of C++ tools that can be used directly |via| the
command line or indirectly through the ``openbt`` Python package, which wraps
Expand All @@ -22,12 +24,18 @@ it can be built with MPI installed on a laptop using the system's package
manager or with MPI installations on leadership class platforms and clusters
that were installed by experts and optimized for their specific platform.

This repository is being established by merging the contents of the original
`OpenBT repository`_ with the `OpenBTMixing repository`_, which was based off of
the former. It, therefore, will supercede those two repositories, which will be
frozen.

This repository and its contents are being established and developed as part of
|band| framework_.

.. note::
While an R wrapper does exist for the original |openbt| and |openbtmixing|
repositories, that functionality has not yet been included in this new,
combined repository (Issue #XYZ).

This package is being developed as part of |band| framework_.
combined repository (`Issue 35`_).

.. toctree::
:numbered:
Expand Down
4 changes: 2 additions & 2 deletions docs/release_procedure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ Otherwise,
* One side effect of the use of ``setuptools-scm`` is that by default it
includes in the distribution all files located within ``openbt_pypkg``.
However, many files and folders in that space do **not** need to be
distributed (|eg| Flake8 configuration files and OpenBT command line tools
installed during development in ``src/openbt/bin``). This is what
distributed (|eg| Flake8 configuration files and |openbt| command line
tools installed during development in ``src/openbt/bin``). This is what
"minimal" means above. Files and folders that should not be included in
the distribution are specified in ``MANIFEST.in``.
* Review the metadata to ensure correct and complete. This should include
Expand Down
2 changes: 1 addition & 1 deletion openbt_pypkg/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE VERSION
include LICENSE
exclude .flake8 .coveragerc
exclude tox.ini
prune src/openbt/bin
Expand Down
22 changes: 0 additions & 22 deletions src/ambrt.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
// ambrt.cpp: Additive mean BART model class methods.
// Copyright (C) 2012-2016 Matthew T. Pratola, Robert E. McCulloch and Hugh A. Chipman
//
// This file is part of OpenBT.
//
// OpenBT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenBT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Author contact information
// Matthew T. Pratola: mpratola@gmail.com
// Robert E. McCulloch: robert.e.mculloch@gmail.com
// Hugh A. Chipman: hughchipman@gmail.com


#include "ambrt.h"
#include "brtfuns.h"
Expand Down
2 changes: 2 additions & 0 deletions src/amxbrt.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// amxbrt.cpp: BART-based model mixing model class methods.

#include "amxbrt.h"
#include "brtfuns.h"
#include <iostream>
Expand Down
22 changes: 0 additions & 22 deletions src/brt.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
// brt.cpp: Base BT model class methods.
// Copyright (C) 2012-2016 Matthew T. Pratola, Robert E. McCulloch and Hugh A. Chipman
//
// This file is part of OpenBT.
//
// OpenBT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenBT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Author contact information
// Matthew T. Pratola: mpratola@gmail.com
// Robert E. McCulloch: robert.e.mculloch@gmail.com
// Hugh A. Chipman: hughchipman@gmail.com


#include "brt.h"
#include "brtfuns.h"
Expand Down
22 changes: 0 additions & 22 deletions src/brtfuns.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
// brtfuns.cpp: Base BT model class helper functios.
// Copyright (C) 2012-2016 Matthew T. Pratola, Robert E. McCulloch and Hugh A. Chipman
//
// This file is part of OpenBT.
//
// OpenBT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenBT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Author contact information
// Matthew T. Pratola: mpratola@gmail.com
// Robert E. McCulloch: robert.e.mculloch@gmail.com
// Hugh A. Chipman: hughchipman@gmail.com


#include "brtfuns.h"

Expand Down
20 changes: 0 additions & 20 deletions src/brtmoves.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
// brtmoves.cpp: Base BT model class advanced MH methods.
// Copyright (C) 2013-2019 Matthew T. Pratola
//
// This file is part of OpenBT.
//
// OpenBT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenBT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Author contact information
// Matthew T. Pratola: mpratola@gmail.com


#include "brt.h"
#include "brtfuns.h"
Expand Down
20 changes: 0 additions & 20 deletions src/cli.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
// cli.cpp: Implement command-line model interface to OpenBT.
// Copyright (C) 2012-2019 Matthew T. Pratola
//
// This file is part of OpenBT.
//
// OpenBT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenBT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Author contact information
// Matthew T. Pratola: mpratola@gmail.com


#include <chrono>
#include <iostream>
Expand Down
Loading