Skip to Content
Deep Learning Quick Reference
book

Deep Learning Quick Reference

by Mike Bernico
March 2018
Intermediate to advanced
272 pages
7h 53m
English
Packt Publishing
Content preview from Deep Learning Quick Reference

One hot encoding

In this function, we will be taking the dictionary we just built and one hot encoding the text of each phrase.

Once we're done, we will be left with three dictionaries. Each of them will be of dimension [number of texts * max sequence length * tokens]. If you squint, and think back to the simpler times of Chapter 10, Training LSTMs with Word Embeddings from Scratch, you can see this is really the same as the other NLP models we've done on the input side. We will define one hot encoding using the following code:

def one_hot_vectorize(data):    input_chars = data['input_chars']    target_chars = data['target_chars']    input_texts = data['input_texts']    target_texts = data['target_texts']    max_encoder_seq_length = data['max_encoder_seq_length' ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Keras Deep Learning Cookbook

Keras Deep Learning Cookbook

Rajdeep Dua, Sujit Pal, Manpreet Singh Ghotra
Deep Learning with Keras

Deep Learning with Keras

Antonio Gulli, Sujit Pal

Publisher Resources

ISBN: 9781788837996Supplemental Content