Skip to content

Instantly share code, notes, and snippets.

View aaronstevenwhite's full-sized avatar

Aaron Steven White aaronstevenwhite

View GitHub Profile
@aaronstevenwhite
aaronstevenwhite / unsupervisedpcfg.py
Last active March 26, 2022 15:42
Unsupervised probabilistic context free grammar induction with expectation maximization
import numpy as np
import pandas as pd
from random import shuffle, choice
from scipy.stats import dirichlet
from scipy.misc import logsumexp
from nltk.tree import Tree
class UnsupervisedPCFG(object):
'''unsupervised pcfg induction with EM
@aaronstevenwhite
aaronstevenwhite / keybase.md
Created March 28, 2018 13:28
Keybase proof for aaronstevenwhite

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@aaronstevenwhite
aaronstevenwhite / childsumtreebilstm_model.py
Created December 2, 2017 16:31
A bidirectional extension of Tai et al.'s (2015) child-sum tree LSTM (for dependency trees) implemented as a pytorch module.
import torch
from torch.nn.modules.rnn import RNNBase
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.modules.dropout import Dropout
import sys
if sys.version_info.major == 3:
from functools import lru_cache