<jupyter_start><jupyter_text>Prototyping RNN on time series<jupyter_code>import matplotlib
import tensorflow as tf
model = tf.keras.Sequential()
# Length of the vocabulary in chars
vocab_size = 16

# The embedding dimension
embedding_dim = 256

# Number of RNN units
rnn_units = 1024
# function from google tutorial 
# https://www.tensorflow.org/tutorials/text/text_generation
    
def build_model(vocab_size, embedding_dim, rnn_units, batch_size):
  model = tf.keras.Sequential([
    tf.keras.layers.Embedding(vocab_size, embedding_dim,
                              batch_input_shape=[batch_size, None]),
    tf.keras.layers.GRU(rnn_units,
                        return_sequences=True,
                        stateful=True,
                        recurrent_initializer='glorot_uniform'),
    tf.keras.layers.Dense(vocab_size)
  ])
  return model
model.add(tf.keras.layers.Embedding(vocab_size, embedding_dim, batch_input_shape=[10, None]))
model.add(tf.keras.layers.LSTM(rnn_units, return_sequences=True, stateful=True))
model.add(tf.keras.layers.Dense(vocab_size))
model.summary()<jupyter_output>Model: "sequential_1"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
embedding_1 (Embedding)      (10, None, 256)           4096      
_________________________________________________________________
lstm_2 (LSTM)                (10, None, 1024)          5246976   
_________________________________________________________________
dense_2 (Dense)              (10, None, 16)            16400     
=================================================================
Total params: 5,267,472
Trainable params: 5,267,472
Non-trainable params: 0
_________________________________________________________________
{'fraction_non_alphanumeric': 0.14631522323830015, 'fraction_numerical': 0.0328133405056482, 'mean_word_length': 3.831168831168831, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '32117', 'license': 'MIT', 'n_tokens_mistral': 560, 'n_tokens_neox': 493, 'n_words': 96, 'path': 'rnn_prototype.ipynb', 'repo_name': 'QinLab/icompbio-tamjeed', 'size': '1859'}