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
val source = CSVFile("pubmed-oa-subset.csv") ~> IDColumn(1); | |
val tokenizer = { | |
SimpleEnglishTokenizer() ~> // tokenize on space and punctuation | |
CaseFolder() ~> // lowercase everything | |
WordsAndNumbersOnlyFilter() ~> // ignore non-words and non-numbers | |
MinimumLengthFilter(3) // take terms with >=3 characters | |
} | |
val text = { |
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 __future__ import division | |
import numpy as np | |
na = np.newaxis | |
from matplotlib import pyplot as plt | |
def adj_path(n): | |
a = np.zeros((n,n)) | |
a.flat[1::a.shape[0]+1] = a.flat[a.shape[0]::a.shape[0]+1] = 1 | |
return a |
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
#!/bin/bash | |
curl -s "http://online.wsj.com/mdc/public/page/2_3020-tips-${1}.html?mod=mdc_pastcalendar" \ | |
| tr '^M' '\n' \ | |
| grep -E '<td class="(([pn]?num)|(text))">' \ | |
| sed -E 's/<[^>]*>([^<]*)<.*/\1/' \ | |
| awk '(NR%6==0){print p; p=""; next}{p=p "\t" $0;}' \ | |
| sed "s/^/${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
#!/bin/bash | |
usage() { echo "usage: ${0##*/} commandstring cachefilename"; } | |
if [ $# -ne 2 ]; then usage; exit 0; fi | |
if [ -e "$2" ] | |
then | |
cat "$2" | |
else | |
eval "$1" | tee $2 | |
fi |
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 __future__ import division | |
import numpy as np | |
def unscented_transform(mu,Sigma,alpha,kappa,beta=2): | |
n = mu.shape[0] | |
lmbda = alpha**2*(n+kappa)-n | |
points = np.empty((2*n+1,n)) | |
mean_weights = np.empty(2*n+1) | |
cov_weights = np.empty(2*n+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
;; the lagrangian for two unconstrained masses in gravity | |
;; (this is just 1/2 m v^2 - mgh from high school) | |
(define ((L-ms-in-g m-tuple g) local) | |
(let ((v-tuple (velocities local)) | |
(q-tuple (coordinate local))) | |
(let ((momenta (uptuple-map (lambda (mi vi) (* (/ 1 2) mi (norm vi))) m-tuple v-tuple)) | |
(potentials (uptuple-map (lambda (mi qi) (* mi g (ref qi 1))) m-tuple q-tuple))) | |
(let ((T (uptuple-reduce + momenta)) | |
(V (uptuple-reduce + potentials))) | |
(- T V))))) |
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 __future__ import division | |
import numpy as np | |
import sys | |
sys.path.append('/Users/mattjj/Dropbox/work/datta/renderer') | |
from MouseData import MouseData | |
m = MouseData('/Users/mattjj/Dropbox/work/datta/renderer/data/mouse_mesh_low_poly3.npz') | |
translations = m.joint_translations | |
def inv(E): |
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 __future__ import division | |
import numpy as np | |
np.seterr(divide='ignore') | |
from matplotlib import pyplot as plt | |
plt.ioff() | |
import pyhsmm | |
pyhsmm.internals.states.use_eigen() | |
from pyhsmm.util.text import progprint_xrange |
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
set PATH "$HOME"/bin /opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/\ | |
/opt/local/bin /opt/local/sbin $PATH | |
set CDPATH . "$HOME" $CDPATH | |
set fish_greeting "" | |
function fish_user_key_bindings | |
bind \e\[1\;9A 'history-token-search-backward' | |
end |
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 __future__ import division | |
import numpy as np | |
from numpy.lib.stride_tricks import as_strided as ast | |
def chunk_data(data,window_size,overlap_size=0,flatten_inside_window=True): | |
assert data.ndim == 1 or data.ndim == 2 | |
if data.ndim == 1: | |
data = data.reshape((-1,1)) | |
# get the number of overlapping windows that fit into the data |