Calculates Dirichlet test and plots 2-simplex Dirichlets
Project description
Dirichlet
A Python package to estimate the Dirichlet distribution, calculate maximum likelihood, and test for independence from a variable based on fitting nested Dirichlet distribution hypotheses.
Most of this package is a port of Thomas P. Minka's wonderful Fastfit MATLAB code. Much thanks to him for that and his clear paper "Estimating a Dirichlet distribution".
Dirichlet Test
This likelihood ratio test for independence will determine whether two Dirichlet-distributed data sets are likely to be from the same distribution or from two different ones, much like a chi-square or G-test for independence, but with Dirichlet models.
Simplex Plots
The dirichlet.simplex module creates scatter, contour, and filled contour 2-simplex plots. To use this, be sure to install the simplex package "extra" (e.g. pip install dirichlet[simplex]).
Caveats
Note that this package at the moment doesn't support sparse data vectors due to the numerical fitting algorithm that uses the gamma function. Possibly some sort of additive smoothing would make this package work in your context, but that will depend on your application.
Installation
pip install dirichlet
# or
uv add dirichlet
This has only been tested with Python 3.10+. Other versions may work, but they haven't been tested.
Development
To install dev tooling, run:
uv sync --frozen --locked --all-groups --all-extras
# To format
uv run ruff format
# To test
uv run pytest
# To lint
uv run ruff
A Github workflow will run tests against several Python versions.
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
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 dirichlet-1.0.0.tar.gz.
File metadata
- Download URL: dirichlet-1.0.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4d872137f2a301b8511d53b4f8ebd532cc64206a6a2a1e089007d8812200664
|
|
| MD5 |
07c573043c98ffda29abda3b277846d0
|
|
| BLAKE2b-256 |
51fa5755c4fa06dd36f233e537ea63b7fca65466cd9716b52aa2fc3eb9b02170
|
Provenance
The following attestation bundles were made for dirichlet-1.0.0.tar.gz:
Publisher:
publish.yml on ericsuh/dirichlet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dirichlet-1.0.0.tar.gz -
Subject digest:
b4d872137f2a301b8511d53b4f8ebd532cc64206a6a2a1e089007d8812200664 - Sigstore transparency entry: 370176445
- Sigstore integration time:
-
Permalink:
ericsuh/dirichlet@acc368e045b652076d8cc5297f65e1b9ba527756 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/ericsuh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@acc368e045b652076d8cc5297f65e1b9ba527756 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dirichlet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dirichlet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d47fb0c8f1392b5e4749a895709f0fc8befa121e368c3c9c90cd0c17e791fb74
|
|
| MD5 |
894b3ae8551c0a900046053b3095bc0d
|
|
| BLAKE2b-256 |
c853c95f9cf52aa562102731330aed9e7bdd145916f52c971ae1074c36b5c8a0
|
Provenance
The following attestation bundles were made for dirichlet-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on ericsuh/dirichlet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dirichlet-1.0.0-py3-none-any.whl -
Subject digest:
d47fb0c8f1392b5e4749a895709f0fc8befa121e368c3c9c90cd0c17e791fb74 - Sigstore transparency entry: 370176462
- Sigstore integration time:
-
Permalink:
ericsuh/dirichlet@acc368e045b652076d8cc5297f65e1b9ba527756 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/ericsuh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@acc368e045b652076d8cc5297f65e1b9ba527756 -
Trigger Event:
release
-
Statement type: