Skip to content

Instantly share code, notes, and snippets.

View maurotoro's full-sized avatar

Mauricio Alejandro Toro Espejo maurotoro

  • Lisbon, Portugal
View GitHub Profile
@beaucronin
beaucronin / crp_generator.py
Created October 9, 2011 16:37
A Python generator for the Chinese Restaurant Process
from random import random
def crpgen(N = None, alpha = 1.0):
"""
A generator that implements the Chinese Restaurant Process
"""
counts = []
n = 0
while N == None or n < N:
# Compute the (unnormalized) probabilities of assigning the new object
@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