Thin Python frontend for a shared C++ Approximate Bayesian Computation backend
Project description
abcpp 
abcpp is a lightweight embeddable C++ library for Approximate Bayesian
Computation, with R and Python wrappers. The C++ library is the only algorithm
implementation; R and Python are thin frontends.
C++ Usage
abcpp can be embedded in another CMake project in the same style as small algorithm libraries such as NLopt, using FetchContent_Declare to call abcpp as the algorithm backend:
include(FetchContent)
FetchContent_Declare(
abcpp
GIT_REPOSITORY https://github.com/yuki-961004/abcpp.git
GIT_TAG main
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(abcpp)
target_link_libraries(my_target PRIVATE abcpp::abcpp)
The primary C++ API is NLopt-like:
#include <abcpp/abcpp.hpp>
abcpp::opt opt;
abcpp::result fit = opt
.set_target(target)
.set_params(params)
.set_sumstats(sumstats)
.set_method(abcpp::method::neuralnet)
.set_tol(0.01)
.set_nnet_sizenet(8)
.run();
R Usage
Install from CRAN:
install.packages("abcpp")
The R interface uses four inputs: target, params, sumstats, and
control.
library(abcpp)
result <- abcpp::abc(
target = <target_summary_vector_or_matrix>,
params = <parameter_vector_or_matrix>,
sumstats = <simulated_summary_vector_or_matrix>,
control = list(
method = "rejection",
tol = <tolerance_between_0_and_1>
)
)
summary(result)
Python Usage
Install from PyPI:
pip install abcpp
The Python interface mirrors the R interface:
import abcpp
result = abcpp.abc(
target=<target_summary_vector_or_matrix>,
params=<parameter_vector_or_matrix>,
sumstats=<simulated_summary_vector_or_matrix>,
control={
"method": "rejection",
"tol": <tolerance_between_0_and_1>,
},
)
abcpp.summary(result)
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file abcpp-1.0.0.tar.gz.
File metadata
- Download URL: abcpp-1.0.0.tar.gz
- Upload date:
- Size: 48.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cac912a7aaaf5c70c24efdd5b0f160b7bc08c0283559fde5a6a679f4e10cf39
|
|
| MD5 |
2647158190ef6c4b25ff96af00faeda3
|
|
| BLAKE2b-256 |
e33a260d88b2d218fc0b02e18c02be3f455144084ef4c591367a89e11da7c8ee
|
File details
Details for the file abcpp-1.0.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: abcpp-1.0.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 178.2 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36fd41093fd568e26c5db606cf25e4cde92937be76809a099e4b576bef3ac98e
|
|
| MD5 |
6294dbc60e185782f82ff326d1ca07a7
|
|
| BLAKE2b-256 |
58fc6a761406326cd8ca1ee35e1e0d17ee3d1188fc1460515a6766ec51ed986c
|