Rust version of Scipy's Fisher exact test.
Project description
faster_fishers
Fast implementation of Fisher's exact test in Rust for Python.
Benchmarks show that this version is about 20x faster than scipy's version when running on a large range of inputs and about 10x faster when running on 1 input:
--------------------------------------------------------------------------------------------- benchmark: 2 tests ---------------------------------------------------------------------------------------------
Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_faster_fischer 114.5763 (1.0) 119.2121 (1.0) 116.1288 (1.0) 1.6386 (1.0) 115.5922 (1.0) 1.6018 (1.0) 2;1 8.6111 (1.0) 9 1
test_benchmark_scipy 2,403.8024 (20.98) 2,458.8598 (20.63) 2,423.2871 (20.87) 21.4687 (13.10) 2,415.6504 (20.90) 24.6082 (15.36) 1;0 0.4127 (0.05) 5 1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Usage:
>>> import numpy as np
>>> import faster_fishers
>>> lefts, right, two_tails = faster_fishers.exact(np.array([1, 3]), np.array([2, 5]), np.array([1, 4]), np.array([5, 50]))
>>> lefts
array([0.9166666666666647, 0.9963034765672586])
>>> rights
array([0.5833333333333326, 0.03970749246529451])
>>> two_tails
array([1.0, 0.03970749246529451])
Developing
Building with cargo
- Run
cargo buildin the main directory to build the project.
Publishing on pypi
docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin publish -u {USER} -p {PASSWORD}
Using locally
- Install environment:
poetry install - Add environment to current shell
poetry shell - Install faster_fishers in current environment:
maturin develop - Check that it works:
python -c "import faster_fishers; print(dir(faster_fishers))"
To try the library in a different environment:
1. maturin build --release
2. cd folder
3. pip install {wheel_path}.whl
Benchmarks
- Make sure to compile in release mode with maturin first:
maturin develop --release*python:pytest --benchmark-warmup -m benchmark
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 Distributions
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 faster_fishers-0.1.1.tar.gz.
File metadata
- Download URL: faster_fishers-0.1.1.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.16-beta.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5643b32157984509549edf05c0e0e0d75b27d546072386bb334e1bb632bf43e
|
|
| MD5 |
3f6112d59545cb74f3397f37efbcc718
|
|
| BLAKE2b-256 |
64dc898b3139b6930e4e6029181a315596deada7c27db2f0564276ab1887c42c
|
File details
Details for the file faster_fishers-0.1.1-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: faster_fishers-0.1.1-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 253.6 kB
- Tags: PyPy, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.16-beta.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3eb149f240ae45610f55aee6f32b6e53ac70febf8a95526ce12a9850c08086e
|
|
| MD5 |
c48cd01b494ec5637592570e407e2049
|
|
| BLAKE2b-256 |
570ee0a010d9325f8a9fba0f1c765424bce25def00f84d47d3f3e748bf804142
|
File details
Details for the file faster_fishers-0.1.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: faster_fishers-0.1.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 251.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.16-beta.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ec1d5a98e5119ad8ad54da4fc21cf4803b6ea26db1cd67e0bdd1bb22153a2d8
|
|
| MD5 |
63a781d595d82a08c0029969959b7f6a
|
|
| BLAKE2b-256 |
6305a4d8bce4db6a40a46e1f4c09d9ee5433552e10865dd6353288e04c37c09c
|
File details
Details for the file faster_fishers-0.1.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: faster_fishers-0.1.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 251.0 kB
- Tags: CPython 3.9, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.16-beta.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78e16ef29836a3a5c2ed20afa170b87e724886f930f41741a1a86455ffcb0c0c
|
|
| MD5 |
27f13ffaa9ff8f571a81664596153896
|
|
| BLAKE2b-256 |
4b6803e9c7bef37c4e3a215e730f7edbb317f309261e11c520bda7d5470c078b
|
File details
Details for the file faster_fishers-0.1.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: faster_fishers-0.1.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 251.1 kB
- Tags: CPython 3.8, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.16-beta.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
242a097d207e07422ebbaecb64bc2df0af01d341db3fbdae2b5d604c60a6d06e
|
|
| MD5 |
ae910f8a4d11d20de51953787fd41415
|
|
| BLAKE2b-256 |
8572661240d813474ecf6738b196dee3a96ed63f5021d475ecf24a39ffdb4d0c
|
File details
Details for the file faster_fishers-0.1.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: faster_fishers-0.1.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 251.1 kB
- Tags: CPython 3.7m, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.16-beta.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f066ef64c7f6630a8c19d503ddb95265923583730ee353a38bb42e6882d007b6
|
|
| MD5 |
1e6b6ed05d281dd12dabe79e40598485
|
|
| BLAKE2b-256 |
82da1267de07b67bf2e13908a7bd61f9c94d5e56a1bd0bd21242618a514cb63c
|