Skip to main content

data modeling and analysis tool based on Bayesian networks

Project description

BAMT framework logo

package

pypi Supported Python Versions Supported Python Versions Supported Python Versions

tests

Build coverage

docs

Documentation Status

license

Supported Python Versions

stats

downloads_stats downloads_monthly downloads_weekly

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

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 edges strength e.t.c.

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 (evolutionary and PC are 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:

import bamt.networks as Nets

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

bn = Nets.HybridBN(has_logit=False, use_mixture=True)
bn.add_edges(discretized_data, scoring_function=('K2',K2Score))
bn.fit_parameters(data)

Examples & Tutorials

More examples can be found in tutorials and 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 direcotries:

  • 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 user to transform data according pipeline (similar to 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:

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

bamt-1.2.71a1.tar.gz (282.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bamt-1.2.71a1-py3-none-any.whl (85.6 kB view details)

Uploaded Python 3

File details

Details for the file bamt-1.2.71a1.tar.gz.

File metadata

  • Download URL: bamt-1.2.71a1.tar.gz
  • Upload date:
  • Size: 282.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.5 Windows/10

File hashes

Hashes for bamt-1.2.71a1.tar.gz
Algorithm Hash digest
SHA256 c8e2ef01ea42f0581d6b5a6439d8d58f37645c434191a1e0154dea051a146754
MD5 301c05d6451fcdfc35b47ff3dfc32288
BLAKE2b-256 4cb36cbcf9fc74fa96bfa312c83f83ab28295972d91ab8800f5e2c3967994f43

See more details on using hashes here.

File details

Details for the file bamt-1.2.71a1-py3-none-any.whl.

File metadata

  • Download URL: bamt-1.2.71a1-py3-none-any.whl
  • Upload date:
  • Size: 85.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.5 Windows/10

File hashes

Hashes for bamt-1.2.71a1-py3-none-any.whl
Algorithm Hash digest
SHA256 5731e50eb703fa2e37d1f47f5b0d089bb5894422b628b44e84721ff4389dd782
MD5 e374f9ab65d05e5a64aaaf04b307b434
BLAKE2b-256 6a4d5f7afd96ded0b1a0e80b119dc1ee147d8d0a0d775252767f7763f2c618c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page