Skip to content

Instantly share code, notes, and snippets.

Avatar

Jake Vanderplas jakevdp

View GitHub Profile
@jakevdp
jakevdp / generative.py
Last active Jun 7, 2021
General Generative Classification for scikit-learn
View generative.py
"""
Bayesian Generative Classifier
------------------------------
"""
# Author: Jake Vanderplas <jakevdp@cs.washington.edu>
import numpy as np
from sklearn.neighbors.kde import KernelDensity
from sklearn.mixture import GMM
from sklearn.base import BaseEstimator, clone
@jakevdp
jakevdp / discrete_cmap.py
Last active May 7, 2021
Small utility to create a discrete matplotlib colormap
View discrete_cmap.py
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""
@jakevdp
jakevdp / CategoricalCMAP.ipynb
Last active Mar 22, 2021
Example of a categorical color map in matplotlib
View CategoricalCMAP.ipynb
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 Mar 15, 2021
Numba Ball Tree example
View README.md

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

@jakevdp
jakevdp / PythonLogo.ipynb
Last active Sep 16, 2020
Creating the Python Logo in Matplotlib
View PythonLogo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakevdp
jakevdp / sklearn_doc.py
Created Sep 30, 2012
Scikit-learn Documentation Template
View sklearn_doc.py
"""
This file has an example function, with a documentation string which should
serve as a template for scikit-learn docstrings.
"""
def sklearn_template(X, y, a=1, flag=True, f=None, **kwargs):
"""This is where a short one-line description goes
This is where a longer, multi-line description goes. It's not
required, but might be helpful if more information is needed.
@jakevdp
jakevdp / .block
Last active Jul 29, 2020
Example of an interactive time-series plot
View .block
license: MIT
@jakevdp
jakevdp / .block
Last active Jul 29, 2020
Interactive Exploration of Seattle Weather
View .block
license: MIT
@jakevdp
jakevdp / .block
Last active Jul 29, 2020
Vega-Lite Bike Counts with Dynamic Scale
View .block
license: MIT
@jakevdp
jakevdp / empty-py2.ipynb
Created Apr 22, 2020
Empty Python 2 notebook
View empty-py2.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.