I hereby claim:
- I am beaucronin on github.
- I am beaucronin (https://keybase.io/beaucronin) on keybase.
- I have a public key ASA8QFopPai5WRhYagivUf6FMWlePH57Q7CPv5R3NK3Irgo
To claim this, I am signing this object:
x = initial() | |
prob = target_dist(x) | |
for i in range(steps): | |
x_star = propose(x) | |
prob_star = target_dist(x) | |
if prob_star > prob or random() < prob_star / prob: | |
x = x_star | |
prob = prob_star |
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 |
sepal_length | sepal_width | petal_length | petal_width | class | |
---|---|---|---|---|---|
5.1 | 3.5 | 1.4 | 0.2 | Iris-setosa | |
4.9 | 3.0 | 1.4 | 0.2 | Iris-setosa | |
4.7 | 3.2 | 1.3 | 0.2 | Iris-setosa | |
4.6 | 3.1 | 1.5 | 0.2 | Iris-setosa | |
5.0 | 3.6 | 1.4 | 0.2 | Iris-setosa | |
5.4 | 3.9 | 1.7 | 0.4 | Iris-setosa | |
4.6 | 3.4 | 1.4 | 0.3 | Iris-setosa | |
5.0 | 3.4 | 1.5 | 0.2 | Iris-setosa | |
4.4 | 2.9 | 1.4 | 0.2 | Iris-setosa |
pr = analysis.predict({'petal_length': 1.5, 'petal_width': None}) | |
interval = pr.credible_values('petal_width') | |
# => (0.06619570898596525, 0.45519138428493605) | |
interval[1] - interval[0] | |
# => 0.38899567529897083 | |
pr = analysis.predict({'petal_length': 5.0, 'petal_width': None}) | |
interval = pr.credible_values('petal_width') | |
# => (1.3341578189754613, 2.4761532421771784) | |
interval[1] - interval[0] |
# generate some noisy-XOR data | |
from random import random | |
N = 1000 | |
noise = 0.1 | |
data = [] | |
for _ in range(N): | |
x1 = random() < 0.5 |
#From http://en.wikipedia.org/wiki/File:Correlation_examples2.svg | |
#Title: An example of the correlation of x and y for various distributions of (x,y) pairs | |
#Tags: Mathematics; Statistics; Correlation | |
#Author: Denis Boigelot | |
#Packets needed : mvtnorm (rmvnorm), RSVGTipsDevice (devSVGTips) | |
#How to use: output() | |
# | |
#This is an translated version in R of an Matematica 6 code by Imagecreator. |
import csv | |
import json | |
rd = csv.reader(open('scotch.csv')) | |
header = rd.next() | |
colors = header[1:15] | |
data = [] | |
schema = { | |
'color': { 'type': 'categorical' }, | |
'AGE': { 'type': 'count' }, |
import veritable | |
import csv | |
import matplotlib.pyplot as plt | |
# Load the csv and read into a Veritable dataset using inches and pounds | |
print 'Reading data from file' | |
data_inches_pounds = [] | |
with open('heights_weights_genders.csv') as fd: | |
rd = csv.reader(fd) | |
rd.next() # skip the header |
import requests | |
import json | |
URL_BASE = 'https://rest.developer.yodlee.com/services/srest/restserver/v1.0' | |
# assumes you've signed up for dev access, and already done the one-time linking of bank accounts | |
# to user accounts via the Yodlee website | |
# cobrand login | |
payload = { 'cobrandLogin': 'sbCob<account>', 'cobrandPassword': '<something>' } |
I hereby claim:
To claim this, I am signing this object: