Skip to content

Instantly share code, notes, and snippets.

@amueller
amueller / dpgmm_sampler.py
Created March 10, 2012 13:31
Nonparametric Gaussian mixture model data sampling
import numpy as np
import scipy.stats
class ChineseRestaurantProcess(object):
def __init__(self, alpha):
self.alpha = alpha
self.customers = []
def sample(self, n_samples=1):
samples = []
@sixtenbe
sixtenbe / analytic_wfm.py
Last active February 14, 2025 21:52 — forked from endolith/peakdet.m
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See