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
var assert = function (condition, message) { | |
if (! condition) | |
throw Error("Assert failed" + (typeof message !== "undefined" ? ": " + message : "")); | |
} |
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
import boto.mturk.connection | |
import boto.mturk.question | |
sandbox_host = 'mechanicalturk.sandbox.amazonaws.com' | |
mturk = boto.mturk.connection.MTurkConnection( | |
aws_access_key_id = 'my aws_access_key_id' | |
aws_secret_access_key = 'my aws_secret_access_key', | |
host = sandbox_host, | |
debug = 2 # debug = 2 prints out all requests. but we'll just keep it at 1 |
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
__author__ = 'arenduchintala' | |
import sys | |
import codecs | |
""" | |
The following sys setup fixes a lot of issues with writing and reading in utf-8 chars. | |
WARNING: pdb does not seem to work if you do reload(sys) | |
""" | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
sys.stdin = codecs.getreader('utf-8')(sys.stdin) |
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
#!/usr/bin/env python | |
# NOTE : This script assumes that the aligments are in the src-tgt format | |
import optparse | |
import pprint | |
import sys | |
import numpy as np | |
optparser = optparse.OptionParser() |
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
__author__ = 'arenduchintala' | |
from edu.jhu.pacaya.gm.model import FactorGraph, FgModel, Var, VarSet, ExpFamFactor, ExplicitExpFamFactor, ExplicitFactor, VarConfig, ClampFactor | |
from edu.jhu.pacaya.gm.train import CrfTrainer | |
from edu.jhu.pacaya.gm.train.CrfTrainer import CrfTrainerPrm | |
from edu.jhu.pacaya.gm.data import FgExampleList, FgExampleDiskStore, FgExampleMemoryStore, LabeledFgExample | |
from edu.jhu.pacaya.gm.feat import FeatureVector | |
from edu.jhu.nlp.joint import OptimizerFactory | |
from edu.jhu.pacaya.gm.inf.BeliefPropagation import BeliefPropagationPrm | |
from edu.jhu.pacaya.gm.inf.BeliefPropagation import BpScheduleType | |
from edu.jhu.pacaya.gm.inf.BeliefPropagation import BpUpdateOrder |
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
[global] | |
mode = FAST_RUN | |
floatX = float32 | |
int_division = floatX | |
exception_verbosity = high | |
warn_float64 = raise | |
allow_gc = False | |
compiledir_format=compiledir-%(platform)s-%(processor)s-%(python_version)s-%(python_bitwidth)s-%(hostname)s | |
linker = cvm | |
openmp = true |
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
# File: .screenrc | |
# # Screen rc file – config options | |
# | |
# # don’t display copyright page | |
startup_message off | |
# | |
# # no audible bell, just visual | |
vbell off | |
# # detach on hangup | |
autodetach on |
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
set nocp | |
syntax on | |
set modeline | |
set ls=2 | |
set backspace=2 | |
set clipboard=unnamed | |
set number | |
set encoding=utf-8 | |
"vijays recommendation | |
" set paste |
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
import theano | |
import theano.tensor as T | |
from theano.tensor.shared_randomstreams import RandomStreams | |
from theano.sandbox.rng_mrg import MRG_RandomStreams | |
from lasagne.updates import adam | |
from lasagne.utils import collect_shared_vars | |
from sklearn.datasets import fetch_mldata | |
from sklearn.cross_validation import train_test_split | |
from sklearn import preprocessing |
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
from bokeh.plotting import figure, ColumnDataSource | |
from bokeh.models import HoverTool | |
def scatter_with_hover(df, x, y, | |
fig=None, cols=None, name=None, marker='x', | |
fig_width=500, fig_height=500, **kwargs): | |
""" | |
Plots an interactive scatter plot of `x` vs `y` using bokeh, with automatic | |
tooltips showing columns from `df`. |