Skip to content

Instantly share code, notes, and snippets.

View rreas's full-sized avatar

Russell Reas rreas

  • Allen Institute for AI
  • Seattle, WA
View GitHub Profile
@rreas
rreas / spkmeans.m
Created June 2, 2012 17:55
Spherical K-Means Clustering
function [U,V,idx] = spkmeans(X,k,tol,imax)
[d,n] = size(X);
U = zeros(d,k);
V = zeros(k,n);
% random clusters and normalize to unit sphere.
for j = 1:n
V(randi(k),j) = 1;
@rreas
rreas / distkmeans.m
Created June 2, 2012 17:56
Euclidean Distance K-Means Clustering
function [U,V,idx] = distkmeans(X,k,tol,imax)
[d,n] = size(X);
U = zeros(d,k);
V = zeros(k,n);
% random clusters.
for j = 1:n
V(randi(k),j) = 1;
@rreas
rreas / exppca.m
Created June 4, 2012 01:22
Exponential Family PCA (Poisson Distribution)
function [U,V] = exppca(X,k,tol,imax)
[d,n] = size(X);
% random initialization.
U = rand(d,k);
V = rand(k,n);
I = eye(k);
% for numerical errors.
@rreas
rreas / logpca.m
Created June 4, 2012 15:49
Logistic PCA
% Adapted from the original, available online:
% http://www.andrewschein.com/software/lpca_code.tar
%
function [U,V] = logpca(X,k,tol,imax)
% ensure we have a binary matrix.
X = spones(X);
[N,D] = size(X);
U = rand(N,k);
@rreas
rreas / als.m
Created June 6, 2012 16:59
Regularized Alternating Least Squares
function [U,V] = als(X,k,tol,imax,lambda)
[d,n] = size(X);
U = rand(k,d);
V = rand(k,n);
I = eye(k);
% convergence monitors.
olderr = 0;
@rreas
rreas / list.md
Last active August 29, 2017 02:46
Computer Science & Web Development Reading List

Discrete mathematics

To really understand data structures and algorithmic complexity, you need to understand discrete math. This the best starting point for CS theory. I love discrete math, others may find it very boring.

  • Essentials of Discrete Mathematics (Hunter)

Data structures

I can't think of a good data structures reading off the top of my head unfortunately. Often the trick to an efficient algorithm is really just an efficient data structure. Check out Dijkstra's algorithm for a great example of this (BFS + min-heap/priority queue).

@rreas
rreas / .vimrc
Last active August 29, 2015 14:10
Monolithic .vimrc
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
@rreas
rreas / .tmux.conf
Created December 13, 2014 21:16
tmux.conf
###########################
# Configuration
###########################
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# default command - use zsh shell
set-option -g default-command "reattach-to-user-namespace -l zsh"
@rreas
rreas / nginx.conf
Created March 17, 2015 22:40
Simple API + UI nginx configuration for development
#user nobody;
daemon off;
worker_processes 1;
events {
worker_connections 256;
}
http {
include mime.types;
@rreas
rreas / readme.txt
Created October 27, 2015 02:01
Notes on Clover install
http://sourceforge.net/projects/cloverefiboot/
To prevent freezing on changing MTU from 0 to 1500 on boot.
http://sourceforge.net/projects/osx86drivers/files/Kext/Snow_or_Above/
Needed drivers/kexts:
1. AptioFix
2. Video resolution fix (cpumem?)
2. Latest Intel driver (E1000e) http://sourceforge.net/projects/osx86drivers/files/Kext/Snow_or_Above/