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
#The input data should be in CSV format. | |
# Each row is a campaign. The columns are (description and variable name): | |
# Campaign id (id) | |
# Conversion rate (cvr) | |
# Bid price (price) | |
# Max allocated campaign budget (max_allocation) | |
import csv | |
import sys |
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
id | cvr | price | max_allocation | |
---|---|---|---|---|
1 | 0.005 | 4 | 100 | |
2 | 0.001 | 0.75 | 100 | |
3 | 0.0001 | 0.1 | 100 |
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
[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
simple and clear algorithm description: | |
http://www.titouangalopin.com/blog/articles/2014/05/simhash-or-the-way-to-compare-quickly-two-datasets | |
a python impl | |
http://liangsun.org/posts/a-python-implementation-of-simhash-algorithm/ | |
original paper of simhash | |
http://www.cs.princeton.edu/courses/archive/spr04/cos598B/bib/CharikarEstim.pdf | |
simhash impl doc |
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
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 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
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
{ | |
"metadata": { | |
"name": "2d Convolution" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
NewerOlder