Skip to content

Instantly share code, notes, and snippets.

View andersx's full-sized avatar

Anders Steen Christensen andersx

View GitHub Profile
@larsbratholm
larsbratholm / kde_example.py
Last active January 23, 2020 09:25
Example of 1d KDE using scipy and sklearn
import scipy.stats
import matplotlib.pyplot as plt
import sklearn.model_selection
import sklearn.neighbors
def kde_scipy(x, x_grid):
"""
Using heuristic for bandwidth
"""
kde = scipy.stats.gaussian_kde(x)
@markus-beuckelmann
markus-beuckelmann / numpy-benchmark.py
Created April 30, 2017 13:06
A short Python script to benchmark NumPy and show your BLAS setup
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Roughly based on: http://stackoverflow.com/questions/11443302/compiling-numpy-with-openblas-integration
from __future__ import print_function
import numpy as np
from time import time
'''
Implementation of Fastfood (Le, Sarlos, and Smola, ICML 2013).
Primarily by @esc (Valentin Haenel) and felixmaximilian
from https://github.com/scikit-learn/scikit-learn/pull/3665.
Modified by @dougalsutherland.
FHT implementation was "inspired by" https://github.com/nbarbey/fht.
'''