Code Monkey home page Code Monkey logo

predective_text's Introduction

Predective_text

A LSTM, RNN based model that auto suggest the next character/word on the basis of previous text input.

Just like auto-suggest in phones while typing, this model was build in order to auto-suggest the next keyword on the basis of previous input text.

This model uses Long-Short-Term-Memory in order to remember the entire sequence of text.

Architecture

This model uses the following Layers :

  1. LSTM layer
  2. Dropout Layer
  3. Dense Layer

Hyperparameters

After tuning various hyperparameters the best performace was found at...

LSTM_layers=128, Dropout=0.2, Activation_function="Softmax", optimizer=RMSprop, learning-rate=0.01

The process terminated at 19 epoch using Earlystopping callback as with further epoch the model might start getting overfitted. It took around 20min to train on my machine without GPU.

Performace

The model shows accuracy of 56% and validation_accuracy of 52% with loss of 1.44, which is acceptable as we want the model to understand the text and not cram it completely.

accuracy_graphloos_graph

Results

The first line is input sequence of 40 words and the output resembles the top 5 suggestions predicted by the model.

Input: those who work honestly have the courage
Output: [' the ', ', ', '--they ', 'd ', 'ness ']

Input: the pain is temporary but the results ar
Output: ['e ', 'tists ', 'ound ', 'a ', 'id ']

Input: i'm not upset that you lied to me but th
Output: ['e ', 'at ', 'is ', 'ought ', 'rough ']

Input: and those who were seen dancing were the
Output: [' strength ', 're ', 'ir ', 'y ', 'mselves ']

Input: it is hard enough to remember my opinion
Output: [' of ', 's ', ', ', '. ', '--the ']

The model was trained on various other hyperparameters to obtain different results. The results can be found at the bottom of the lstm.py

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.