All Projects → bolducp → Hierarchical Rnn

bolducp / Hierarchical Rnn

Tensorflow implementation of a Hierarchical and Multiscale RNN, described in https://arxiv.org/abs/1609.01704

Projects that are alternatives of or similar to Hierarchical Rnn

Arduino Max30100
Arduino library for MAX30100, integrated oximeter and heart rate sensor
Stars: ✭ 134 (-1.47%)
Mutual labels:  jupyter-notebook
Robust representations
Code for "Learning Perceptually-Aligned Representations via Adversarial Robustness"
Stars: ✭ 137 (+0.74%)
Mutual labels:  jupyter-notebook
Python Deep Learning Projects
Python Deep Learning Projects, published by Packt
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook
Google refexp toolbox
The toolbox for the Google Refexp dataset proposed in this paper: http://arxiv.org/abs/1511.02283
Stars: ✭ 135 (-0.74%)
Mutual labels:  jupyter-notebook
Monthly Challenges
Repository containing monthly challenges about quantum computing.
Stars: ✭ 126 (-7.35%)
Mutual labels:  jupyter-notebook
Spanet
Spatial Attentive Single-Image Deraining with a High Quality Real Rain Dataset (CVPR'19)
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook
2016 Ml Contest
Machine learning contest - October 2016 TLE
Stars: ✭ 135 (-0.74%)
Mutual labels:  jupyter-notebook
Pytorchviz
A small package to create visualizations of PyTorch execution graphs
Stars: ✭ 2,054 (+1410.29%)
Mutual labels:  jupyter-notebook
Kyle School
쏘카 데이터 그룹 사내 신입/인턴을 대상으로 한 카일 스쿨
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook
Reproduce Chexnet
Reproduce CheXNet
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook
Blog stuff
experiments and snippets used on the blog
Stars: ✭ 135 (-0.74%)
Mutual labels:  jupyter-notebook
Poppy
Physical Optics Propagation in Python
Stars: ✭ 135 (-0.74%)
Mutual labels:  jupyter-notebook
Data Driven Pdes
Stars: ✭ 135 (-0.74%)
Mutual labels:  jupyter-notebook
Data Science Wg
SF Brigade's Data Science Working Group.
Stars: ✭ 135 (-0.74%)
Mutual labels:  jupyter-notebook
Deep Steganography
Hiding Images within other images using Deep Learning
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook
Opencv projects
List of OpenCV projects to further increase the computer vision community. Coding in Python & C++(In progress).
Stars: ✭ 135 (-0.74%)
Mutual labels:  jupyter-notebook
Pytorch 101 Tutorial Series
PyTorch 101 series covering everything from the basic building blocks all the way to building custom architectures.
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook
R
Using R with Jupyter / RStudio on Binder
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook
Deeplearningfornlpinpytorch
An IPython Notebook tutorial on deep learning for natural language processing, including structure prediction.
Stars: ✭ 1,744 (+1182.35%)
Mutual labels:  jupyter-notebook
Site
Course materials for the Automating GIS processes -course, University of Helsinki, Finland
Stars: ✭ 136 (+0%)
Mutual labels:  jupyter-notebook

hmlstm

This package implements the Hierarchical Multiscale LSTM network described by Chung et al. in https://arxiv.org/abs/1609.01704

The network operates much like a normal multi-layerd RNN, with the addition of boundary detection neturons. These are neurons in each layer that, ideally, learn to fire when there is a 'boundary' at the scale in the original signal corresponding to that layer of the network.

Installation

pip install git+https://github.com/n-s-f/hierarchical-rnn.git

Or, if you're interested in changing the code:

git clone https://github.com/n-s-f/hierarchical-rnn.git
cd hierarchical
python setup.py develop

Character Classification

In this example, we'll consider the text8 data set, which contains only lower case english characters, and spaces. We'll train on all batches but the last, and test on just the last batch.

from hmlstm import HMLSTMNetwork, prepare_inputs, get_text

batches_in, batches_out = prepare_inputs(batch_size=10, truncate_len=5000, 
                                         step_size=2500, text_path='text8.txt')
                                         
network = HMLSTMNetwork(output_size=27, input_size=27, embed_size=2048, 
                        out_hidden_size=1024, hidden_state_sizes=1024, 
                        task='classification')

network.train(batches_in[:-1], batches_out[:-1], save_vars_to_disk=True, 
              load_vars_from_disk=False, variable_path='./text8')

predictions = network.predict(batches_in[-1], variable_path='./text8')
boundaries = network.predict_boundaries(batches_in[-1], variable_path='./text8')

# visualize boundaries
viz_char_boundaries(get_text(batches_out[-1][0]), get_text(predictions[0]), boundaries[0])

Time series prediction

In this example, we'll do three-step-ahead prediction on a noisy set of signals with sinusoidal activity at two scales.

from hmlstm import HMLSTMNetwork, convert_to_batches, plot_indicators

network = HMLSTMNetwork(input_size=1, task='regression', hidden_state_sizes=30,
                       embed_size=50, out_hidden_size=30, num_layers=2)
                       
# generate signals
num_signals = 300
signal_length = 400
x = np.linspace(0, 50 * np.pi, signal_length)
signals = [np.random.normal(0, .5, size=signal_length) +
           (2 * np.sin(.6 * x + np.random.random() * 10)) +
           (5 * np.sin(.1* x + np.random.random() * 10))
    for _ in range(num_signals)] 
    
batches_in, batches_out = convert_to_batches(signals, batch_size=10, steps_ahead=3)


network.train(batches_in[:-1], batches_out[:-1], save_vars_to_disk=True, 
              load_vars_from_disk=False, variable_path='./sinusoidal')

predictions = network.predict(batches_in[-1], variable_path='./sinusoidal')
boundaries = network.predict_boundaries(batches_in[-1], variable_path='./sinusoidal')

# visualize boundaries
plot_indicators(batches_out[-1][0], predictions[0], indicators=boundaries[0])

Further information

Please see the doc strings in the code for more detailed documentation, and the demo notebook for more thorough examples.

Pull requests or open github issues for improvements are very welcome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].