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
#!/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 |
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
'''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. |
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 | |
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 = [] |