Bayesian tests for comparison of classifiers
Project description
baycomp
Baycomp is a library for Bayesian comparison of classifiers.
Functions compare two classifiers on one or on multiple data sets. They
compute three probabilities: the probability that the first classifier has
higher scores than the second, the probability that differences are within
the region of practical equivalence (rope), or that the second classifier
has higher scores. We will refer to this probabilities as p_left
, p_rope
and p_right
. If the argument rope
is omitted (or set to zero), functions
return only p_left
and p_right
.
The region of practical equivalence (rope) is specified by the caller and should correspond to what is "equivalent" in practice; for instance, classification accuracies that differ by less than 0.5 may be called equivalent.
Similarly, whether higher scores are better or worse depends upon the type of the score.
The library can also plot the posterior distributions.
The library can be used in three ways.
-
Two shortcut functions can be used for comparison on single and on multiple data sets. If
nbc
andj48
contain a list of average classification accuracies of naive Bayesian classifier and J48 on a collection of data sets, we can call>>> two_on_multiple(nbc, j48, rope=1) (0.23124, 0.00666, 0.7621)
(Actual results may differ due to Monte Carlo sampling.)
With some additional arguments, the function can also plot the posterior distribution from which these probabilities came.
-
Tests are packed into test classes. The above call is equivalent to
>>> SignedRankTest.probs(nbc, j48, rope=1) (0.23124, 0.00666, 0.7621)
and to get a plot, we call
>>> SignedRankTest.plot(nbc, j48, rope=1, names=("nbc", "j48"))
To switch to another test, use another class::
>>> SignTest.probs(nbc, j48, rope=1) (0.26508, 0.13274, 0.60218)
-
Finally, we can construct and query sampled posterior distributions.
>>> posterior = SignedRankTest(nbc, j48, rope=0.5) >>> posterior.probs() (0.23124, 0.00666, 0.7621) >>> posterior.plot(names=("nbc", "j48"))
Installation
Install from PyPI:
pip install baycomp
Documentation
User documentation is available on https://baycomp.readthedocs.io/.
A detailed description of the implemented methods is available in Time for a Change: a Tutorial for Comparing Multiple Classifiers Through Bayesian Analysis, Alessio Benavoli, Giorgio Corani, Janez Demšar, Marco Zaffalon. Journal of Machine Learning Research, 18 (2017) 1-36.
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
Built Distribution
File details
Details for the file baycomp-1.0.2.tar.gz
.
File metadata
- Download URL: baycomp-1.0.2.tar.gz
- Upload date:
- Size: 154.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c43472c16bd7cdf4884dd4c73dd307e4a3da7097fe49c83cd5e88d75142923b0 |
|
MD5 | b7a16e379b748427ef321be7e19032a4 |
|
BLAKE2b-256 | 6ef749f0cb5f1d1b2421036360d59da131c69224cfcfb483def506831b6515d4 |
File details
Details for the file baycomp-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: baycomp-1.0.2-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68eae1611a98be002b60246961ec20e3b798e02c757e0e0121755f1b62f444fb |
|
MD5 | 88180d6bf087589a2a827adf83491f86 |
|
BLAKE2b-256 | 05693029fe9fe13e4ec14d9d6be695ee197e4cd75221c7f77eb95ac5604035b4 |