Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kalaidin
kalaidin / Spark_IPython_MacOS.md
Last active October 13, 2015 09:44 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark + IPython Notebook Guide for Mac OS X

Apache Spark + IPython Notebook Guide for Mac OS X

Tested with Apache Spark 1.5.1, Python 3.3 and Java 1.8.0_60

Install Java Development Kit

Download and install JDK from oracle.com

@kalaidin
kalaidin / fm_lr.py
Created May 28, 2015 22:11
Logistic regression + Factorization machines + SGD
import numpy as np
from math import exp, log
"""
SGD for logistic loss + factorization machines
The code follows this paper:
[1] http://www.ics.uci.edu/~smyth/courses/cs277/papers/factorization_machines_with_libFM.pdf
"""
def sigmoid(x):
@kalaidin
kalaidin / frugal_streaming.ipynb
Last active August 29, 2015 13:58
Frugal Streaming IPython notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kalaidin
kalaidin / frugal_streaming.R
Last active August 29, 2015 13:58
Percentiles with frugal streaming
frugal <- function(stream) {
m <- 0
for (val in stream) {
if (val > m)
m = m + 1
else if (val < m)
m = m - 1
}
return(m)
}