Built with blockbuilder.org
Built with blockbuilder.org
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 | |
| import numpy as np | |
| import cPickle | |
| import random | |
| import matplotlib.pyplot as plt | |
| class RNN(object): | |
| def __init__(self, nin, n_hidden, nout): |
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 gensim import models | |
| sentence = models.doc2vec.LabeledSentence( | |
| words=[u'so`bme', u'words', u'here'], tags=["SENT_0"]) | |
| sentence1 = models.doc2vec.LabeledSentence( | |
| words=[u'here', u'we', u'go'], tags=["SENT_1"]) | |
| sentences = [sentence, sentence1] | |
| class LabeledLineSentence(object): |
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
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |