A Python package for AnDE classifiers.
Project description
scikit-bayes
scikit-bayes is a Python package that extends scikit-learn with a suite of Bayesian Network Classifiers.
The primary goal of this package is to provide robust, scikit-learn-compatible implementations of advanced Bayesian classifiers that are not available in the core library.
Key Features
- MixedNB: Naive Bayes for mixed data types (Gaussian + Categorical + Bernoulli) in a single model
- AnDE: Averaged n-Dependence Estimators (AODE, A2DE) that relax the independence assumption
- ALR: Accelerated Logistic Regression - hybrid generative-discriminative models with 4 weight granularity levels
- WeightedAnDE: Discriminatively-weighted ensemble models
- Full scikit-learn API: Compatible with pipelines, cross-validation, and grid search
Quick Start
import numpy as np
from skbn import MixedNB, AnDE
# MixedNB: Handle mixed data types automatically
X = np.array([[1.5, 0, 2], [-0.5, 1, 0], [2.1, 1, 1], [-1.2, 0, 2]])
y = np.array([0, 1, 1, 0])
clf = MixedNB()
clf.fit(X, y)
print(clf.predict([[0.5, 1, 1]])) # Automatically handles Gaussian, Bernoulli, Categorical
# AnDE: Solve problems Naive Bayes cannot (XOR)
X_xor = np.array([[-1, -1], [-1, 1], [1, -1], [1, 1]])
y_xor = np.array([0, 1, 1, 0])
clf = AnDE(n_dependence=1, n_bins=2)
clf.fit(X_xor, y_xor)
print(clf.predict(X_xor)) # [0, 1, 1, 0] ✓
Installation
pip install scikit-bayes
Or install from source:
pip install git+https://github.com/ptorrijos99/scikit-bayes.git
Documentation
- 📖 User Guide - Detailed documentation
- 📚 API Reference - Complete API docs
- 🎨 Examples Gallery - Visual examples
Development
This project uses pixi for environment management.
# Run tests
pixi run test
# Run linter
pixi run lint
# Build documentation
pixi run build-doc
# Activate development environment
pixi shell -e dev
Citation
If you use scikit-bayes in a scientific publication, please cite:
@software{scikit_bayes,
author = {Torrijos, Pablo},
title = {scikit-bayes: Bayesian Network Classifiers for Python},
year = {2025},
url = {https://github.com/ptorrijos99/scikit-bayes}
}
References
- Webb, G. I., Boughton, J., & Wang, Z. (2005). Not so naive Bayes: Aggregating one-dependence estimators. Machine Learning, 58(1), 5-24.
- Flores, M. J., Gámez, J. A., Martínez, A. M., & Puerta, J. M. (2009). GAODE and HAODE: Two proposals based on AODE to deal with continuous variables. ICML '09, 313-320.
- Zaidi, N. A., Webb, G. I., Carman, M. J., & Petitjean, F. (2017). Efficient parameter learning of Bayesian network classifiers. Machine Learning, 106(9-10), 1289-1329.
License
BSD-3-Clause. See LICENSE for details.
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 scikit_bayes-0.1.3.tar.gz.
File metadata
- Download URL: scikit_bayes-0.1.3.tar.gz
- Upload date:
- Size: 143.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efa18592b8f52e47b09c2b6f847c9239ba34d8edfed33685dbb8f276ee429859
|
|
| MD5 |
3a71bfb7801636ffca53d4a60bc575ca
|
|
| BLAKE2b-256 |
93fe3267bc45c5357c08ffb3c3867d2b1479a2aca97e288061fb5f97105224cf
|
Provenance
The following attestation bundles were made for scikit_bayes-0.1.3.tar.gz:
Publisher:
publish.yml on ptorrijos99/scikit-bayes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scikit_bayes-0.1.3.tar.gz -
Subject digest:
efa18592b8f52e47b09c2b6f847c9239ba34d8edfed33685dbb8f276ee429859 - Sigstore transparency entry: 969431107
- Sigstore integration time:
-
Permalink:
ptorrijos99/scikit-bayes@c0c21f30cc3d567d14a212a930f51b0a74f17824 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ptorrijos99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c0c21f30cc3d567d14a212a930f51b0a74f17824 -
Trigger Event:
release
-
Statement type:
File details
Details for the file scikit_bayes-0.1.3-py3-none-any.whl.
File metadata
- Download URL: scikit_bayes-0.1.3-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30ab572c164dda192d263258370d10ce2b30a1ddd3e9cf0df8c20c1d727bdaf4
|
|
| MD5 |
1c23d6c4eab0545e2e34b95ab38a6641
|
|
| BLAKE2b-256 |
5a42ce9cce3aedbccf4381b4c3dcc6bce06077080f03b3caf928ddde6241f939
|
Provenance
The following attestation bundles were made for scikit_bayes-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on ptorrijos99/scikit-bayes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scikit_bayes-0.1.3-py3-none-any.whl -
Subject digest:
30ab572c164dda192d263258370d10ce2b30a1ddd3e9cf0df8c20c1d727bdaf4 - Sigstore transparency entry: 969431121
- Sigstore integration time:
-
Permalink:
ptorrijos99/scikit-bayes@c0c21f30cc3d567d14a212a930f51b0a74f17824 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ptorrijos99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c0c21f30cc3d567d14a212a930f51b0a74f17824 -
Trigger Event:
release
-
Statement type: