This file contains hidden or 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
:) |
This file contains hidden or 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
// | |
// Sparse LU Decomposition (Gilbert-Peierls) | |
// | |
#include <iostream> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <vector> | |
#include <functional> | |
#include <algorithm> | |
#include <cmath> |
This file contains hidden or 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
// Two-layer Neural Network | |
// | |
// USAGE: | |
// ./a.out in.txt out.txt | |
// gnuplot -e "plot 'in.txt', 'out.txt'; pause 2" | |
// | |
#include <iostream> | |
#include <cstdio> | |
#include <ctime> | |
#include <cstdlib> |
This file contains hidden or 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
% Radial Basis Function expansion | |
% | |
% f(x) = sum k(x, yi) wi | |
% -> w = k(X,Y) \ f(X) | |
% here k(x,y) := rho(|x-y|), e.g., exp(-|x-y2|^2) | |
% input data | |
N = 100; | |
X = rand(N,1); | |
fX = abs( cos( 2 * 3.14 * (X .* X) ) ); |
This file contains hidden or 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
// Read MNIST Database (handwritten digits) | |
// | |
// Usage: | |
// 1. download | |
// train-images-idx3-ubyte.gz | |
// train-labels-idx2-ubyte.gz | |
// from | |
// http://yann.lecun.com/exdb/mnist/ | |
// and extract them. | |
// |
This file contains hidden or 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
// | |
// Nearlest Neighbour Classification for MNIST dataset | |
// | |
#include <iostream> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cmath> | |
#include <map> | |
#include <vector> | |
#include <queue> |
This file contains hidden or 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
// | |
// Support Vector Machine | |
// (gradient descent with log-sum-exp approximation) | |
// | |
// original: | |
// G(w) := min_{+,-} { <w, x_+> - <w,x_-> } --> maximize | |
// approx: | |
// G'(w) := -log sum_{+,-} exp (-<w, x_+> - <w,x_->) --> maximize | |
// <=> | |
// L(w) := sum_{+,-} exp -<w, x_+ - x_-> --> minimize |
This file contains hidden or 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
// Bellman-Ford / DIjkstra hybrid for shortest path | |
// | |
// D. Yefem and I. Rotem (2010): | |
// Hybrid Bellman-Ford-Dijkstra Algorithm, | |
// TechnicalReport, Ben-Gurion University of the Negev. | |
// | |
#include <iostream> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cmath> |
This file contains hidden or 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
# coding: utf-8 | |
# | |
# easy_install tweepy | |
# easy_install python-dateutil | |
# | |
from tweepy import OAuthHandler, Stream | |
from tweepy.streaming import StreamListener | |
import tweepy, sys, json | |
from time import strptime | |
import datetime, calendar, dateutil.parser |
This file contains hidden or 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
// Bigram graph G = (V,E) | |
// V: set of words | |
// E: u->v iff "u v" occurs in the document | |
// | |
// Usage: ./a.out < pg11.txt | |
// ( http://www.gutenberg.org/cache/epub/11/pg11.txt ) | |
// | |
// the 0.0514497 | |
// and 0.0313457 | |
// to 0.0241298 |
OlderNewer