Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fisher-rxc

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fisher-rxc

Fast multithreaded implementation for calculating Fisher's exact test for any RxC sized table

  • 0.15.0
  • PyPI
  • Socket score

Maintainers
1

Fisher RxC

Fast multithreaded implementation of calculating Fisher's exact test for any RxC size table. Written in Rust using Maturin.

Installation

pip install fisher-rxc
import fisher

Usage

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.

Return values

0 <= x <= 1: p-value

x < 0: error code number, message printed to stdout

Performance

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
-----------

References

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


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc