Skip to content

Instantly share code, notes, and snippets.

@tloredo
tloredo / ScrapeNetflixRatings.py
Created January 17, 2014 23:35
Python script for scraping a Netflix user's movie ratings from the user's ratings web pages.
"""
Scrape a user's Netflix movie ratings by automating a Safari browsing
session (with the user already logged in). The ratings are written
as tab-delimited UTF-8 encoded text in a plain text file.
This Python script is for terminal-savvy Mac users.
To use
======
@tloredo
tloredo / NotebookIntro.ipynb
Created February 6, 2015 19:16
Quick intro to the IPython notebook for BDA course
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tloredo
tloredo / BVNGridSpec.py
Created April 15, 2015 06:10
GridSpec example for BVNDemo IPython notebook
# This won't run as a standalone Python script; put it in a cell at
# the bottom of your BVNDemo IPy notebook and run it there.
# Get BVN samples to plot.
bvn = BivariateNormal([0,0], [1,1], .7)
xyvals = bvn.sample(500)
# We'll put 3 different, related axes in a single new figure.
fig = figure(figsize=(8,6))
@tloredo
tloredo / PyStanNormNormTest.py
Last active August 29, 2015 14:19
Basic test of PyStan using a normal mean estimation problem
"""
Test an installation of PyStan using a simple normal mean estimation problem.
The script does a Stan fit to simulated data from a normal distribution,
estimating the mean with a normal prior/normal sampling dist'n model. It prints
summaries of the posterior to the terminal, and plots two figures showing
traceplots (of the posterior mean and the log density) and an estimated
posterior PDF (blue curve) along with the analytical PDF (green dashed curve).
Three statistical tests are run, with results printed to the terminal. They
1 Start time: 18:52:58 06/21/15
2
3 Revision: 1323
4
5 Model Identifier: MacBookPro10,2
6 System Version: OS X 10.10.3 (14D136)
7 Kernel Version: Darwin 14.3.0
8 Time since boot: 6 minutes
9
10 FileVault 2