Giter Site home page Giter Site logo

imclab / lstmvis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hendrikstrobelt/lstmvis

1.0 2.0 0.0 4.59 MB

Visualization Toolbox for Long Short Term Memory networks (LSTMs)

License: BSD 3-Clause "New" or "Revised" License

HTML 1.43% JavaScript 7.11% Python 3.50% Lua 2.12% Jupyter Notebook 85.83%

lstmvis's Introduction

Visual Analysis for State Changes in RNNs

More information about LSTMVis, an introduction video, and the link to the live demo can be found at lstm.seas.harvard.edu

Install

Clone the repository:

git clone https://github.com/HendrikStrobelt/LSTMVis.git; cd LSTMVis

Install python (server-side) requirements using pip:

pip install -r requirements.txt

on OSX 10.11 (El Capitan):
pip install --user -r requirements.txt

Download & Unzip example dataset(s):

Children Book - Gutenberg - 2.2 GB

start server:

python server.py -dir <datadir>

open browser at http://localhost:8888 - eh voila !

Adding Your Own Data

If you want to train your own data first, please read the Training document. If you have your own data at hand, adding it to LSTMVis is very easy. You only need three files:

  • HDF5 file containing the state vectors for each time step (e.g. cbt_epoch10.h5)
  • HDF5 file containing a word ID for each time step (e.g. train.h5)*
  • Dict file containing the mapping from word ID to word (e.g. words.dict)*

A schematic representation of the data:

Data Format

*If you don't have these files yet, but a space-separated .txt file of your training data instead, check out our text conversion tool

Data Directory

LSTMVis parses all subdirectories of <datadir> for config files lstm.yml. A typical <datadir> might look like this:

<datadir>
├── children_book  		<--- project directory
│   ├── lstm.yml 		<--- config file
│   ├── cbt_epoch10.h5 	<--- states for each time step
│   ├── train.h5 		<--- word ID for each time step
│   └── words.dict 		<--- mapping word ID -> word
├── fun .. 

Config File

a simple example of an lstm.yml is:

name: children books  # project name
description: children book texts from the Gutenberg project # little description

files: # assign files to reference name
  states: cbt_epoch10.h5 # HDF5 files have to end with .h5 or .hdf5 !!!
  word_ids: train.h5
  words: words.dict # dict files have to end with .dict !!

word_sequence: # defines the word sequence
  file: train # HDF5 file
  path: word_ids # path to table in HDF5
  dict_file: words # dictionary to map IDs from HDF5 to words

states: # section to define which states of your model you want to look at
  file: states # HDF5 files containing the state for each position
  types: [
  	{type: state, layer: 1, path: states1}, # type={state, output}, layer=[1..x], path = HDF5 path
	{type: state, layer: 2, path: states2},
  	{type: output, layer: 2, path: output2}
  ]

Intrigued ? Here is more..

Check out our documents about:

Credits

LSTMVis is a collaborative project of Hendrik Strobelt, Sebastian Gehrmann, Bernd Huber, Hanspeter Pfister, and Alexander M. Rush at Harvard SEAS.

lstmvis's People

Contributors

hendrikstrobelt avatar sebastiangehrmann avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.