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:
--------------------------------------------------------------------------------------------- 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 build
in the main directory to build the project.
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
faster_fishers-0.1.0.tar.gz
(15.0 kB
view hashes)
Built Distributions
Close
Hashes for faster_fishers-0.1.0-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8cc40df476bd94b06df5b276ac45717458519bb19bdcb919fd0ab22f1b41b89 |
|
MD5 | db747ab79466e97adb05bcabb3f54757 |
|
BLAKE2b-256 | fad96a8a491d8b9534b02c4ad5db2aade1ab9d9f12df164b96cc8dc5319494ce |
Close
Hashes for faster_fishers-0.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a92c7bf248feeaee3bb772712a48846b556e3ba4cf29f38f4ce5e36b65b82ee8 |
|
MD5 | 98285765d9ec810e96854831b0c9c22b |
|
BLAKE2b-256 | 1acc8e3cfbc21b4c102fb2e39d1f8aa766aed225587329018a1a9b62fef993d3 |
Close
Hashes for faster_fishers-0.1.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | daf0ce11c22e156f9f6e78029dffb46679dc6c16fafed84d1c59679955de8b8d |
|
MD5 | a5d304ac79f031dabef1dd64f1f04c41 |
|
BLAKE2b-256 | af978f71064752f1080f0d51723e3f0f5552b7cebb88cbfc8d19898df2a2c5a7 |
Close
Hashes for faster_fishers-0.1.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eafd7de693ec9dca27e0948e614c946d4ec66cabd64d7c38106978cf4cb81f1a |
|
MD5 | c042ed061cde3e1d25f087c1c8cab208 |
|
BLAKE2b-256 | afaad68bc82389586c0cc6c60fbd6b24abac53ce6cc3eb6be6685a540135ddc0 |
Close
Hashes for faster_fishers-0.1.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 452cc08ade11c620080eeda30bc06008525d4621f0bb39247682c504ba0341be |
|
MD5 | fb969d073570c77edd22c8caa81bd6fb |
|
BLAKE2b-256 | 479eab83f7edcde3f89a65f10e13da10a553c16402ad2514fcf2097e8e964402 |