Skip to content

Instantly share code, notes, and snippets.

View rth's full-sized avatar

Roman Yurchak rth

View GitHub Profile

Benchmarking matrix multiplications with numpy in Pyodide 0.17.0dev0

This gist includes benchmarks for matrix multiplication (DGEMM) using numpy in Pyodide.

Currently Pyodide includes Netlib (reference) BLAS via CLAPACK, and it would useful to replace if by a high performance BLAS such as BLIS in the future (pyodide#227). Related to benchmarks done by @ethanhs for Blis with WebAssembly https://twitter.com/ethanhs/status/1381500482858803200

@rth
rth / SanFrancisco.Neighborhoods.json
Created May 21, 2020 12:59 — forked from cdolek/SanFrancisco.Neighborhoods.json
San Francisco Neighborhoods GeoJson with Zipcodes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rth
rth / supervised_tf.py
Created February 26, 2019 16:31 — forked from larsmans/supervised_tf.py
Supervised tf (tf-chi², tf-rf) for scikit-learn
import numpy as np
#from scipy.special import chdtrc
from scipy.sparse import spdiags
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.preprocessing import LabelBinarizer
def _chisquare(f_obs, f_exp, reduce):
"""Replacement for scipy.stats.chisquare with custom reduction.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rth
rth / output.txt
Last active February 5, 2018 23:09
/home/rth/src/scikit-learn/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
/home/rth/src/scikit-learn/sklearn/grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
DeprecationWarning)
/home/rth/src/scikit-learn/sklearn/learning_curve.py:22: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the functions are moved. This module will be removed in 0.20
DeprecationWarning)
/home/rth/src/scikit-learn/sklearn/utils/validation.py:661: DataConversio
"""
This script aims to benchmark different parallelization options for pairwise metrics in scikit-learn.
The results can be found in https://github.com/scikit-learn/scikit-learn/issues/8216
The environement is setup with,
conda create -n sklearn-env scikit-learn==0.18.1 jupyter python==3.5
and this benchmark should be run with,
@rth
rth / mmap_pairwise_distances_benchmark.py
Created January 20, 2017 16:48
A parallel benchmark for parallel pairwise_distances for scikit-learn issue https://github.com/scikit-learn/scikit-learn/issues/8216
from sklearn.metrics import pairwise_distances
from sklearn.externals.joblib import Parallel, delayed, dump, load
import numpy as np
import tempfile
import os
from sklearn.utils import gen_even_slices
import shutil
os.environ['TMPDIR'] = '/dev/shm/'
np.random.seed(99999)
@rth
rth / cosine_distance_metric_benchmark.py
Created November 8, 2016 12:02
A quick benchmark for computing a metric based on the cosine distance
from math import sqrt, acos
import numpy as np
def make_test_arrays(N, norm=True):
X = np.random.rand(N)
Y = np.random.rand(N)
if norm:
X /= np.linalg.norm(X)
Y /= np.linalg.norm(Y)
return X, Y
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.