Installation#
scikit-bayes needs Python 3.10 or later, NumPy, SciPy, joblib, Numba and scikit-learn 1.6 or later. pip installs them with the package.
From PyPI#
pip install scikit-bayes
From GitHub#
The development version, from the main branch:
pip install git+https://github.com/ptorrijos99/scikit-bayes.git
From source#
To work on the code, clone the repository and install it in editable mode, so that changes to the sources take effect without reinstalling:
git clone https://github.com/ptorrijos99/scikit-bayes.git
cd scikit-bayes
pip install -e .
The development environments, with the dependencies of the tests, the linter and the documentation, are managed with pixi (see Getting Started).
First use of each model#
The counting and the prediction run in Numba kernels, compiled the first time
each model is used, so the first fit of a model after installing or upgrading
the package takes longer. The compiled code is cached on disk by Numba, and
later sessions load it instead of compiling again (see
Computational considerations). On a laptop the first fit takes from a
couple of seconds (skbn.MixedNB) to some ten
(skbn.AnDE).
Checking the installation#
python -m skbn
prints the versions of the package and of its dependencies, fits and
evaluates every model once on the iris data, which compiles and caches all
the kernels (about half a minute the first time, a couple of seconds
afterwards), and verifies the results: probabilities that are finite and sum
to one, the equality of skbn.MixedNB with scikit-learn’s
GaussianNB and the cut-points of skbn.MDLPDiscretizer. With
--n-jobs 4 it compiles the threaded versions of the kernels. From Python,
skbn.check_installation() does the same and
skbn.show_versions() prints the versions alone, to paste in a bug
report.