Skip to content

Instantly share code, notes, and snippets.

View jjerphan's full-sized avatar
🐜
"Neque enim solum nobis divites esse volumus […]"

Julien Jerphanion jjerphan

🐜
"Neque enim solum nobis divites esse volumus […]"
View GitHub Profile
@jjerphan
jjerphan / env.json
Created September 14, 2026 11:45
JSON environment specification used for linking benchmarks in mamba-org/mamba#4401
{"id":"7405242045992098","specs":["xeus-python"],"channels":["emscripten-forge-4x","conda-forge"],"packages":{"xeus-6.0.5-hbf34205_0.conda":{"hash":{"md5":"de79fb0836ea2840cca7719ec94a9958","sha256":"8ec1b66ae38f285c7ffb189e0f833079c88aee7334223b1cba45a5210b021621"},"name":"xeus","size":411232,"build":"hbf34205_0","subdir":"linux-64","channel":"conda-forge","version":"6.0.5"},"zstd-1.5.7-hb78ec9c_7.conda":{"hash":{"md5":"aa459086047c0e5e27023ab19f8cb86a","sha256":"47d682b9f6d6ec9eb1a6e6c3e75ea6273e899e78fb7fc59f81d39745009fbc60"},"name":"zstd","size":601301,"build":"hb78ec9c_7","subdir":"linux-64","channel":"conda-forge","version":"1.5.7"},"krb5-1.22.2-hbc21106_2.conda":{"hash":{"md5":"53318d715316929a574f83591308b1f8","sha256":"2a5c38c85e63df84c4e69ee71439841ce570d259ae3060627bb9a49a938d66f4"},"name":"krb5","size":1394333,"build":"hbc21106_2","subdir":"linux-64","channel":"conda-forge","version":"1.22.2"},"ncurses-6.6-hdb14827_1.conda":{"hash":{"md5":"ee6c0cd80a60961a1f48aa3e0b91f986","sha256":"5d46557214ed1
@jjerphan
jjerphan / app_s1_speedup_vs_n.svg
Last active September 15, 2026 14:48
Figures for faster NumPy in the browser from OpenBLAS
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jjerphan
jjerphan / pyarrow_to_c_abi.ipynb
Last active June 28, 2023 09:37
pyarrow to Arrow C Data API
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jjerphan
jjerphan / open_mp_joblib_threading_comparison.ipynb
Created February 16, 2023 10:07
OpenMP vs joblib Threading backend
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jjerphan
jjerphan / vtable.md
Last active September 29, 2023 07:22
Cython Extension Types' Methods' dispatch using vtable (extracted from https://github.com/scikit-learn/scikit-learn/pull/20254#discussion_r716904109)

Does self.distance_metric.rdist use a v-table look up? (I am curious. This may not be actionable)

Yes, it does.


V-table implementation details
@jjerphan
jjerphan / benchmark.py
Created October 14, 2021 13:44
CuML -- sklearn -- sklearnex NearestNeighbors Benchmarks
import sys
import cudf
import joblib
import numpy as np
impo
@jjerphan
jjerphan / mahalanobis.pyx
Last active June 29, 2021 12:09
Python interaction when using memory views as attributes on Cython classes
%%cython --annotate
#cython: boundscheck=False
#cython: wraparound=False
#cython: cdivision=True
## Adapted from sklearn.neighbors.Mahalanobis
# https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/neighbors/_dist_metrics.pyx#L669
import numpy as np
cimport numpy as np
@jjerphan
jjerphan / setup.py
Last active December 2, 2021 10:58
std::vector to numpy array coercion via Cython
# Cython compile instructions
import numpy
from setuptools import setup, Extension
from Cython.Build import build_ext
# To compile, use
# python setup.py build --inplace
extensions = [
Extension("stdvect_to_ndarray",
import numpy as np
from sklearn.neighbors import DistanceMetric
from .common import Benchmark
class DistanceMetricBenchmark(Benchmark):
param_names = ["n", "d"]
params = ([100, 1000, 10_000], [5, 10, 100])
def setup(self, n, d):
from sklearn.feature_selection import mutual_info_regression, mutual_info_classif
from sklearn.neighbors import KernelDensity, NearestNeighbors
from .common import Benchmark
from sklearn.datasets import make_classification, make_regression
class RemovedCheckBenchmarks(Benchmark):
param_names = ['n', 'd']
params = (