Skip to content

Commit

Permalink
Merge pull request rasbt#43 from rasbt/ch16-figs
Browse files Browse the repository at this point in the history
Ch16 figs
  • Loading branch information
rasbt authored Nov 4, 2019
2 parents 397df59 + 3b4798e commit 9e2550b
Show file tree
Hide file tree
Showing 20 changed files with 857 additions and 1,599 deletions.
2,035 changes: 506 additions & 1,529 deletions ch16/ch16_part1.ipynb

Large diffs are not rendered by default.

53 changes: 51 additions & 2 deletions ch16/ch16_part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,57 @@







# # Introducing sequential data
#
# ## Modeling sequential data⁠—order matters
#
# ## Representing sequences
#
#





# ## The different categories of sequence modeling





# # RNNs for modeling sequences
#
# ## Understanding the RNN looping mechanism
#









# ## Computing activations in an RNN
#









# ## Hidden-recurrence vs. output-recurrence
#







Expand Down Expand Up @@ -98,9 +133,19 @@


# ## The challenges of learning long-range interactions
#





#
# ## Long Short-Term Memory cells





# # Implementing RNNs for sequence modeling in TensorFlow
#
# ## Project one: predicting the sentiment of IMDb movie reviews
Expand Down Expand Up @@ -261,7 +306,7 @@ def encode_map_fn(text, label):
32, padded_shapes=([-1],[]))


# #### Embedding layers for sentence encoding
# ### Embedding layers for sentence encoding
#
#
# * `input_dim`: number of words, i.e. maximum integer index + 1.
Expand All @@ -281,6 +326,10 @@ def encode_map_fn(text, label):







model = tf.keras.Sequential()

model.add(Embedding(input_dim=100,
Expand Down
335 changes: 267 additions & 68 deletions ch16/ch16_part2.ipynb

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions ch16/ch16_part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@







# ## Project two: character-level language modeling in TensorFlow
#





# ### Preprocessing the dataset


Expand All @@ -49,6 +58,10 @@







chars_sorted = sorted(char_set)
char2int = {ch:i for i,ch in enumerate(chars_sorted)}
char_array = np.array(chars_sorted)
Expand All @@ -67,6 +80,10 @@







ds_text_encoded = tf.data.Dataset.from_tensor_slices(text_encoded)

for ex in ds_text_encoded.take(5):
Expand All @@ -91,6 +108,10 @@







## define the function for splitting x & y
def split_input_target(chunk):
input_seq = chunk[:-1]
Expand Down Expand Up @@ -253,10 +274,22 @@ def sample(model, starting_str,
#
# ## A basic version of self-attention
#
#





# ### Parameterizing the self-attention mechanism with query, key, and value weights
#

#
# ## Multi-head attention and the Transformer block





#
# ...
#
Expand Down
Binary file added ch16/images/16_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ch16/images/16_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9e2550b

Please sign in to comment.