Skip to content

Instantly share code, notes, and snippets.

@jamestwebber
jamestwebber / numba_mannwhitney.py
Last active August 21, 2023 16:39
numba-fied, parallelized Mann-Whitney U-test for 2d arrays
import numpy as np
import numba as nb
import scipy.stats
@nb.njit(parallel=True)
def tiecorrect(rankvals):
"""
parallelized version of scipy.stats.tiecorrect
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakevdp
jakevdp / README.md
Last active September 30, 2023 13:25
Numba Ball Tree example

Numba Ball Tree

This is a quick attempt at writing a ball tree for nearest neighbor searches using numba. I've included a pure python version, and a version with numba jit decorators. Because class support in numba is not yet complete, all the code is factored out to stand-alone functions in the numba version. The resulting code produced by numba is about ~10 times slower than the cython ball tree in scikit-learn. My guess is that part of this stems from lack of inlining in numba, while the rest is due to some sort of overhead

@ycopin
ycopin / taylorDiagram.py
Last active May 19, 2024 06:06
Taylor diagram for python/matplotlib [ 10.5281/zenodo.5548061 ]
#!/usr/bin/env python
# Copyright: This document has been placed in the public domain.
"""
Taylor diagram (Taylor, 2001) implementation.
Note: If you have found these software useful for your research, I would
appreciate an acknowledgment.
"""