Skip to main content

BAMT framework logo

BAMT - Bayesian Analytical and Modelling Toolkit

Repository of a data modeling and analysis tool based on Bayesian networks.

Badges

team ITMO NCCR
package pypi Supported Python Versions Supported Python Versions
tests Build coverage
docs Documentation Status
license license
stats downloads downloads/month downloads/week
style Black

Introduction

BAMT - Bayesian Analytical and Modelling Toolkit. This repository contains a data modeling and analysis tool based on Bayesian networks. It can be divided into two main parts - algorithms for constructing and training Bayesian networks on data and algorithms for applying Bayesian networks for filling gaps, generating synthetic data, assessing edge strength, etc.

bamt readme scheme

Installation

BAMT package is available via PyPi:

pip install bamt

BAMT Features

The following algorithms for Bayesian Networks learning are implemented:

  • Building the structure of a Bayesian network based on expert knowledge by directly specifying the structure of the network.
  • Building the structure of a Bayesian network on data using three algorithms - Hill Climbing, evolutionary, and PC (PC is currently under development). For Hill Climbing, the following score functions are implemented - MI, K2, BIC, AIC. The algorithms work on both discrete and mixed data.
  • Learning the parameters of distributions in the nodes of the network based on Gaussian distribution and Mixture Gaussian distribution with automatic selection of the number of components.
  • Non-parametric learning of distributions at nodes using classification and regression models.
  • BigBraveBN - algorithm for structural learning of Bayesian networks with a large number of nodes. Tested on networks with up to 500 nodes.

Difference from existing implementations:

  • Algorithms work on mixed data.
  • Structural learning implements score-functions for mixed data.
  • Parametric learning implements the use of a mixture of Gaussian distributions to approximate continuous distributions.
  • Non-parametric learning of distributions with various user-specified regression and classification models.
  • The algorithm for structural training of large Bayesian networks (> 10 nodes) is based on local training of small networks with their subsequent algorithmic connection.

bn example gif

For example, in terms of data analysis and modeling using Bayesian networks, a pipeline has been implemented to generate synthetic data by sampling from Bayesian networks.

synthetics generation

How to use

Then the necessary classes are imported from the library:

from bamt.networks.hybrid_bn import HybridBN

Next, a network instance is created and training (structure and parameters) is performed:

bn = HybridBN(has_logit=False, use_mixture=True)
bn.add_edges(preprocessed_data)
bn.fit_parameters(data)

Examples & Tutorials

More examples can be found in Documentation.

Publications about BAMT

We have published several articles about BAMT:

Project structure

The latest stable version of the library is available in the master branch.

It includes the following modules and directories:

  • bamt - directory with the framework code:
    • Preprocessing - module for data preprocessing
    • Networks - module for building and training Bayesian networks
    • Nodes - module for nodes support of Bayesian networks
    • Utilities - module for mathematical and graph utilities
  • data - directory with data for experiments and tests
  • tests - directory with unit and integration tests
  • tutorials - directory with tutorials
  • docs - directory with RTD documentation

Preprocessing

Preprocessor module allows users to transform data according to the pipeline (similar to the pipeline in scikit-learn).

Networks

Three types of networks are implemented:

  • HybridBN - Bayesian network with mixed data
  • DiscreteBN - Bayesian network with discrete data
  • ContinuousBN - Bayesian network with continuous data

They are inherited from the abstract class BaseNetwork.

Nodes

Contains classes for nodes of Bayesian networks.

Utilities

Utilities module contains mathematical and graph utilities to support the main functionality of the library.

Web-BAMT

A web interface for BAMT is currently under development. The repository is available at web-BAMT.

Contacts

If you have questions or suggestions, you can contact us at the following address: ideeva@itmo.ru (Irina Deeva)

Our resources:

Citation

@misc{BAMT,
  author={BAMT},
  title = {Repository experiments and data},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/ITMO-NSS-team/BAMT.git}},
  url = {https://github.com/ITMO-NSS-team/BAMT.git}
}

@article{deeva2023advanced,
  title={Advanced Approach for Distributions Parameters Learning in Bayesian Networks with Gaussian Mixture Models and Discriminative Models},
  author={Deeva, Irina and Bubnova, Anna and Kalyuzhnaya, Anna V},
  journal={Mathematics},
  volume={11},
  number={2},
  pages={343},
  year={2023},
}

Metadata

Release files for BAMT 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BAMT 1.3.0
File Size Uploaded
bamt-1.3.0.tar.gz 67.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for BAMT 1.3.0
File Interpreter ABI Platform
bamt-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 157.9 kB

Release files / bamt-1.3.0.tar.gz

Download URL bamt-1.3.0.tar.gz
Size 67.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ae94238d6dc4c657064b6b09f6da10e8588b74c7f19291e956de2a68f8f3a9f9
BLAKE2b-256 checksum
How to use checksums
64b04664a2fb1f3c5a84456886561e94d0806eda46606445b357e7ce6ed838d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-57-generic

Release files / bamt-1.3.0-py3-none-any.whl

Download URL bamt-1.3.0-py3-none-any.whl
Size 90.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0769c55748b5dada36fe06a92aad0febadce883c97f755f5789a197b40280e5a
BLAKE2b-256 checksum
How to use checksums
5d966215d7ed2e2ba58b1001ea9ba18baf5db155b8c2957aff443164a4e1630a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-57-generic

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.72

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.1.44

2 release files

1.1.40

2 release files

1.1.33

2 release files

1.1.32

2 release files

1.1.31

2 release files

1.1.30

2 release files

1.1.25

2 release files

1.0.22

2 release files

1.0.21

2 release files

1.0.20

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page