I hereby claim:
- I am nsaphra on github.
- I am nsaphra (https://keybase.io/nsaphra) on keybase.
- I have a public key ASCpyzsqtJYqR6IjSCnoPwSjrInpOg35MPypGR9l_pvTcQo
To claim this, I am signing this object:
| """ | |
| Because pytorch does not expose the internal activations of a module, | |
| we must instead rerun the same exact function inside that module. | |
| This is written specifically for a 1 layer LSTM with all default settings. | |
| """ | |
| import torch | |
| import torch.nn as nn | |
| from torch.autograd import Variable |
| import sys | |
| types = set() | |
| token_count = 0 | |
| for i, line in enumerate(sys.stdin): | |
| if i % 1000 == 0: | |
| print('.') | |
| line = line.strip().split() | |
| types.update(line) |
| # -*- coding: utf-8 -*- | |
| import os | |
| from random import shuffle | |
| import argparse | |
| parser = argparse.ArgumentParser(description='shuffle a corpus such that the tags and the original tokenized text still align') | |
| parser.add_argument('--unshuffled_dir', type=str) | |
| parser.add_argument('--shuffled_dir', type=str) | |
| parser.add_argument('--tag_suffix', type=str, default='.tag') | |
| args = parser.parse_args() |
I hereby claim:
To claim this, I am signing this object:
| def zipf(size, exponent): | |
| x = np.arange(size, dtype='float') | |
| pmf = (x ** exponent).reciprocal() | |
| pmf /= pmf.sum() | |
| return stats.rv_discrete(values=range(size), pmf) |
| class NoughtsAndCrosses: | |
| NOUGHT = "O" | |
| CROSS = "X" | |
| EMPTY = " " | |
| STALEMATE = "Nobody" | |
| def __init__(self): | |
| self.board = [[self.EMPTY] * 3, [self.EMPTY] * 3, [self.EMPTY] * 3] |
| #!/bin/bash | |
| if [ "$TERM" != "screen" ] | |
| then | |
| if type tmux >/dev/null 2>&1 | |
| then | |
| tmux att || tmux \ | |
| new -s tensorflow -n shell \; \ | |
| neww -n notebook "source activate tensorflow; cd Documents/dynamic_curriculum; jupyter notebook" \; \ | |
| neww -n dir "cd Documents/dynamic_curriculum" |
| type SyntaxNode | |
| label::AbstractString | |
| parent::SyntaxNode | |
| children::Array{SyntaxNode} | |
| # TODO No error handling when going up a level with undefined parent. | |
| SyntaxNode() = ( | |
| x = new(); | |
| x.label = ""; | |
| x.children = []; |
| #!/usr/bin/python | |
| from collections import defaultdict | |
| import json | |
| import os | |
| import argparse | |
| import gzip | |
| import sys | |
| import codecs | |
| from time import asctime |
| module SparsePy | |
| # TODO this is only for CSC sparse matrix PyObjects and julia matrices. | |
| # Add other types when julia releases them? | |
| require("PyCall") | |
| using PyCall | |
| export jlmat2pymat, pymat2jlmat | |
| @pyimport scipy.sparse as pysparse |