Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tungwaiyip
tungwaiyip / Bay Area Bike Share.ipynb
Last active August 29, 2015 13:56
Bay area Bike Share (2014-02-24)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tungwaiyip
tungwaiyip / plot_chi.R
Created October 29, 2012 04:25
Plot the PDF and CDF of chi-square distribution
# install the RColorBrewer package
#install.packages("RColorBrewer")
library(RColorBrewer)
cols <- brewer.pal(8, "OrRd")
cols = cols[3:8]
cols <- brewer.pal(8, "Set1")
x=seq(0,8,0.1)
k_lst=c(1,2,3,4,6,9)
@tungwaiyip
tungwaiyip / factor.py
Created October 8, 2012 06:07
Factor data structure using numpy
import itertools
import operator
import numpy as np
def compute_joint_distribution(factor_lst):
assert factor_lst
J = factor_lst[0]
for f in factor_lst[1:]: