Giter Club home page Giter Club logo

rnn-from-scratch's Introduction

RNN from Scratch

Tutorial : Unfolding RNNs II - Vanilla, GRU, LSTM RNNs from scratch in Tensorflow

The objective is to build and train RNNs for dummy tasks, using Tensorflow's scan module.

Help

# set path to PAULG_PATH
#  set filename to PAULG_FILENAME
python3 data.py 
# set path to 'data/paulg/' in data.load_data
python3 lstm-stacked.py -t # train
python3 lstm-stacked.py -g --num_words 1000 # generate

Hallucinations

Our Abinlinution is tend's so, it's much last to zero familization in the high school society Microsoft we could be meetings change of hemorable to start a startup\n that take \n because server-startups machine whatever they have getting economics end-gradea is decisions like the religion a high-methlity, C8N Disps?And the founders who seem no was the\n gain of beil. Or not replacing. It's not stupide than help-baround togethers. The related\n wealth.Be aid it, not is tried along\n job what's what a startup hubs.The web liked an impressively big\n people the way to be some downbar office themselves gradually be: it's ton, you disappoint it seffect the organization\n being the last time when we were always be founded, eithin the last in creating business are raising geats in an adbitious problem is friex, he may make a company have to started out to bringing himself in big treen of users.\n Sundrad mericonds who've never olders were, people want. [15]]4. Since the reason\n\n school.

The full list of results is available here.

rnn-from-scratch's People

Contributors

suriyadeepan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rnn-from-scratch's Issues

Adapting your single-layer LSTM model for binary classification

Hello, thanks for making this code available. It's useful because I'm trying to create a custom, LSTM cell (with additional logic for the "forget" gate), and you've clearly coded out the internal logic of the cell.

This isn't so much an issue on the repo I'm writing about. I'm wondering if you could explain and possibly show how to adapt the model for predicting a binary outcome. Let's say the new outcome variable is made like this:

from sklearn.preprocessing import OneHotEncoder, LabelBinarizer, LabelEncoder

_, Y = make_classification(n_samples = 118929, n_classes = 2, n_features=2, n_redundant=0, n_informative=1, n_clusters_per_class=1)
label_encoder = LabelEncoder()
integer_encoded = label_encoder.fit_transform(Y)
onehot_encoder = OneHotEncoder(sparse=False)
integer_encoded = integer_encoded.reshape(len(integer_encoded), 1)
onehot_encoded = onehot_encoder.fit_transform(integer_encoded)
Y = onehot_encoded

I feel very close but I'm getting errors here: tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits, labels=ys_)

Thank you!

input gate should use tanh for activation

thanks for this awesome implementation.

fyi, the input gate i = tf.sigmoid(tf.matmul(x,U[0]) + tf.matmul(st_1,W[0])) typically uses tanh as the activation function (unlike other gates, which should use sigmoid).

if tf.scan version is faster??

Thanks for the tutorial code. I wonder if the tf.scan version of a recurrent network is faster than its RNN implementation?

UnicodeDecodeError in data.py

UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 9290: illegal multibyte sequence

Hi, I am following your vanilla RNN code. and I encounter an error above.
so, goggled and found the solution below.

  • encoded file via 'cp949' makes this error sometimes
  • fyi, I use anaconda, python 3, in windows 7
# line 25 of data.py
def read_lines(filename):
    #with open(filename) as f:
    with open(filename, 'rt', encoding='UTF8') as f:
        return f.read().split('\n')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.