This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import numpy as np | |
age_ranges = ['13-24', '25-35', '36-52', '53-64'] | |
device_options = ['Phone', 'Tablet'] | |
platform_options = ['a', 'i'] | |
def weighted_choice(weights): | |
totals = np.cumsum(weights) | |
norm = totals[-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from datetime import datetime | |
from copy import deepcopy | |
from random import random | |
def append_features_from_user_block(user_block, user_row): | |
user_row["num_turns"] = len(user_block) | |
user_row["min_balance"] = min([x["balance"] for x in user_block]) | |
user_row["max_balance"] = max([x["balance"] for x in user_block]) | |
user_row["min_level"] = min([x["level"] for x in user_block]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://users.ics.aalto.fi/ella/publications/randproj_kdd.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from sys import stdout | |
from random import choice, seed, shuffle | |
from copy import deepcopy | |
basic_shapes = [ | |
[(0,0), (1,0), (2,0)], | |
[(0,0), (0,1), (0,2)], | |
[(0,0), (-1,1), (-2,2)], | |
[(0,0), (-1,0), (-2,0)], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Python Scientific Lecture Notes]: (http://scipy-lectures.github.io/index.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Exploiting feature covariance in high-dimensional online learning | |
% http://videolectures.net/aistats2010_ma_efcih/ | |
% http://sysnet.ucsd.edu/projects/url/ | |
function [err,mu,sigma,mem] = cw(X,Y,params) | |
% X is k features by N instances | |
% Y is 1 label in {-1,1} by N instances | |
% params is struct containing options | |
% err: cumulative mistakes after each example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# launch an ec2 instance with lucid (ubuntu 10.04) e.g. ami-ad36fbc4 | |
# ssh to the machine | |
################################################################ | |
# install java | |
# https://ccp.cloudera.com/display/CDHDOC/Java+Development+Kit+Installation | |
# RELEASE=lucid, which you can find by running lsb_release -c. | |
################################################################ | |
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dumbo start demo_dumbo.py -hadoop /usr/lib/hadoop -input shares -output video_demos -outputformat text -files hdfs://ec2-xxx-xx-xx-xx.compute-1.amazonaws.com:8020/user/ubuntu/users/part-m-00000 | |
### piece of code in demo_dumbo.py | |
for line in file('part-m-00000'): | |
print line | |
# ---------------- | |
dumbo start demo_dumbo.py -hadoop /usr/lib/hadoop -input shares -output video_demos -outputformat text -files hdfs://ec2-xxx-xx-xx-xx.compute-1.amazonaws.com:8020/user/ubuntu/users | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://mrtopf.de/blog/en/a-small-introduction-to-python-eggs/ | |
sudo apt-get install python-setuptools | |
python setup.py bdist_egg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install gfortran libblas-dev liblapack-dev | |
cd scipy-0.10.0 | |
python setupegg.py bdist_egg | |
# wait about 5 minutes on my machine |
OlderNewer