Skip to content

Instantly share code, notes, and snippets.

View frederik-laboyrie's full-sized avatar

Frederik Laboyrie frederik-laboyrie

View GitHub Profile
@neubig
neubig / lstm-lm.py
Last active August 23, 2017 09:18
This is a minimal implementation of training for a language model using long short-term memory (LSTM) neural networks
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a simplified implementation of the LSTM language model (by Graham Neubig)
#
# LSTM Neural Networks for Language Modeling
# Martin Sundermeyer, Ralf Schlüter, Hermann Ney
# InterSpeech 2012
#
# The structure of the model is extremely simple. At every time step we
'''A few notes before we begin
I'll separate my notes into three types, docstrings like this, whole line comments, and
inline comments. Docstrings will discuss the ideas behind the objects. What's the intent,
and what programming concepts do they present that are worth discussing. Full line comments
will discuss the details of the implementation. What the code is doing and why. Inline
comments will comprise a small portion of my notes, and are mostly to point out examples
mentioned in the rest of my notes, or return values. Another convention that I use is
backticks, which will be used to refer to an actual object in the code. If I say the word
one, it's just a word, but `one` is a reference to some object in code.
@tristanwietsma
tristanwietsma / adaboost.py
Created April 30, 2013 01:13
AdaBoost Python implementation of the AdaBoost (Adaptive Boosting) classification algorithm.
from __future__ import division
from numpy import *
class AdaBoost:
def __init__(self, training_set):
self.training_set = training_set
self.N = len(self.training_set)
self.weights = ones(self.N)/self.N
self.RULES = []