Bayesian Additive Regression Models
Project description
BARMPy
Intro
barmpy
is the Python implementation of Baeysian Additive Regression Models, a generalization of BART, currently being researched [1]. We hope this library is useful for practictioners, enabling Bayesian architecture search and model ensembling.
Skeleton repo adapted from BartPy.
Check out the Tutorial
Quick Start
barmpy
is on PyPi! Install the latest released version with pip install barmpy
. barmpy
also strives to be compatible with sklearn
and easy-to-use. If you have arrays of target data, Y
, and input data, X
, you can quickly train a model and make predictions using it. barmpy
currently supports ensembles of neural networks for both regression and binary classification. See below for simple examples.
from sklearn import datasets, metrics
from barmpy.barn import BARN, BARN_bin
import numpy as np
# Regression problem
db = datasets.load_diabetes()
model = BARN(num_nets=10,
random_state=0,
warm_start=True,
solver='lbfgs',
l=1)
model.fit(db.data, db.target)
pred = model.predict(db.data)
print(metrics.r2_score(db.target, pred))
# Classification problem
bc = datasets.load_breast_cancer()
bmodel = BARN_bin(num_nets=10,
random_state=0,
warm_start=True,
solver='lbfgs',
l=1)
bmodel.fit(bc.data, bc.target)
pred = bmodel.predict(bc.data)
print(metrics.classification_report(bc.target, np.round(pred)))
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file barmpy-1.2.1.tar.gz
.
File metadata
- Download URL: barmpy-1.2.1.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d226feb534c81a659a4382829b59efeeaf9cbc59f9563446e74013cc7caf492a |
|
MD5 | 6436eef5ad93caad270e69517a421fc6 |
|
BLAKE2b-256 | 13bafe4a676906a1afd9ece9add318118bacef1e7493ff140af4bf9db55a26b3 |
File details
Details for the file barmpy-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: barmpy-1.2.1-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93b8171b37bf702759aab24fbd50d03a1b536b8de08ad2e222461000e183fed7 |
|
MD5 | 271e1f6ac85848f2b30da92aa9258b98 |
|
BLAKE2b-256 | 00b390fce124d886b118047d3d52d23924904ba08fcdf7df8dc023904775916d |