Skip to content

Instantly share code, notes, and snippets.

View jakevdp's full-sized avatar

Jake Vanderplas jakevdp

View GitHub Profile
@jakevdp
jakevdp / enhanced_markdown.py
Created April 29, 2013 13:54
An experimental set of small Pelican plugins to add Jekyl-style enhancements to markdown
import warnings
import re
import itertools
from pelican.readers import MarkdownReader, EXTENSIONS
from pelican.utils import pelican_open
from pelican import signals
def split_args(argstring):
@jakevdp
jakevdp / JSAnimate.ipynb
Last active December 17, 2015 07:38
Prototype Javascript Animation Viewer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakevdp
jakevdp / generative.py
Last active September 23, 2021 15:24
General Generative Classification for scikit-learn
"""
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 / README.md
Last active February 20, 2020 22:25
A generator of random Bible-ish verses

Bibleish.py

This is a simple NLTK Python script which uses N-grams to construct phrases from a generative language model trained on the King James Bible.

@jakevdp
jakevdp / BenchNB.ipynb
Last active December 31, 2015 02:09
Naive Bayes benchmarks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakevdp
jakevdp / plot_window.html
Last active January 1, 2016 22:39
Zooming/Panning example with D3
<html>
<head>
<style>
.axis line, .axis path {
shape-rendering: crispEdges;
stroke: black;
stroke-width: 1;
fill: none;
}
@jakevdp
jakevdp / README.md
Last active August 29, 2015 13:56
Supernovae Fitting

Supernova Fitting

See the attached notebook in nbviewer

import jinja2
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
import mpld3
from mpld3 import plugins, utils
@jakevdp
jakevdp / JSClass1.js
Last active August 29, 2015 13:57
A simple Javascript inheritance pattern
/**********************************************************************
I've been working with javascript for a bit, and I miss my
Python-style namespaces and class inheritance. Here's a little
pattern I came up with that allows me to do things (kind of)
the way I wish I could within javascript. I'd be curious if any
experienced JS users have comments or critiques. Thanks!
Edit - also see the second version (which I think is more clean)
below.
**********************************************************************/
@jakevdp
jakevdp / README.md
Last active February 11, 2024 00:16
D3/IPython widget example

D3 IPython Widget Example

A simple example of two-way communication between IPython notebook and javascript, using a D3 widget.

View this notebook on nbviewer, but be aware that it won't work without being connected to an IPython kernel!

It's better to download the notebook itself and open it with IPython notebook.