
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Fast multithreaded implementation for calculating Fisher's exact test for any RxC sized table
Fast multithreaded implementation of calculating Fisher's exact test for any RxC size table. Written in Rust using Maturin.
pip install fisher-rxc
import fisher
fisher.exact(table, workspace=None)
Calculate Fisher's exact test for 2D list according to Mehta & Patel's Network Algorithm. If workspace size is not provided, it will be "guessed" dynamically.
Workspace size of 2e8 takes at most 800MB of RAM.
fisher.sim(table, iterations)
Calculate Fisher's exact test for 2D list by multithreaded Monte Carlo simulation. A modern CPU can quickly do 10^7 iterations and get accurate results.
fisher.recursive(table)
[!WARNING] This is experimental and may not work on every CPU platform and generation. Any feedback is appreciated
Calculate Fisher's exact test by a multithreaded SIMD recursive algorithm. Despite extensive optimization efforts, this is still generally much slower than the fisher.exact function. Only use for small tables with low numbers.
0 <= x <= 1
: p-value
x < 0
: error code number, message printed to stdout
See benchmark.py
AMD Ryzen 5600X running Linux Mint 21.3
-- EXACT TEST --
fisher-rxc 0.2631 in 21.11s
rpy2 0.2631 in 26.15s
-----------
fisher-rxc 0.9981 in 4.95s
rpy2 0.9981 in 6.96s
-----------
-- MONTE-CARLO SIMULATION --
fisher-rxc 0.2631 in 0.60s
rpy2 0.2630 in 16.10s
-----------
fisher-rxc 0.9981 in 0.62s
rpy2 0.9981 in 19.38s
-----------
Contingency table generator (ASA159): https://people.sc.fsu.edu/~jburkardt/c_src/asa159/asa159.html
Fisher' exact test - network algorithm (ASA643): https://netlib.org/toms/643.gz
Fisher's exact test - recursive: https://stackoverflow.com/questions/25368284/fishers-exact-test-for-bigger-than-2-by-2-contingency-table
Fortran to C transpiler: https://www.netlib.org/f2c/
C to Rust transpiler: https://github.com/immunant/c2rust
FAQs
Fast multithreaded implementation for calculating Fisher's exact test for any RxC sized table
We found that fisher-rxc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.