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

Creating reverse indices

The decoder is going to predict the index of the correct character, which will be the argmax of the softmax output of the decoder. We're going to need to be able to map the index to the character. As you might recall, we have a character to index mapping already in the data dictionary, so we just need to reverse it. It's simple enough to reverse a dictionary, as follows:

def create_reverse_indicies(data):    data['reverse_target_char_index'] = dict(        (i, char) for char, i in data["target_token_index"].items())    return data

Then, we can call this function as follows:

data = create_reverse_indicies(data)
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