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.2.tar.gz
.
File metadata
- Download URL: barmpy-1.2.2.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42e349a7d79597e042ef27d4f1bbfdeebe2391f509b4496ec419a584a644ec6e |
|
MD5 | a04600d36a3dcdc0c3d7842c6f3a6b1f |
|
BLAKE2b-256 | 2a43d279f1d53897e98e13160229114901101247df9ecaeb11bf621d4ac5aba2 |
File details
Details for the file barmpy-1.2.2-py3-none-any.whl
.
File metadata
- Download URL: barmpy-1.2.2-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.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dec412bb202434f1c0f6d10a82a624f4591f6ad3f42019231522f9db84a856c |
|
MD5 | 9c2325f549c1cc9062cb657ec25d8c1b |
|
BLAKE2b-256 | 1c3d61a9cde61f24c1cbe3383011ebec2d7a3da96131085d7317300a7ef813df |