- To start, we load the necessary libraries for the script:
import os import re import string import requests import numpy as np import collections import random import pickle import matplotlib.pyplot as plt import tensorflow as tf
- Next, we start a graph session and set the RNN parameters:
sess = tf.Session()# Set RNN Parameters
min_word_freq = 5
rnn_size = 128
epochs = 10
batch_size = 100
learning_rate = 0.001
training_seq_len = 50
embedding_size = rnn_size
save_every = 500
eval_every = 50
prime_texts = ['thou art more', 'to be or not to', 'wherefore art thou']
- We set up the data and model folders and filenames, along with declaring punctuation to be removed. We will want to keep hyphens and apostrophes because Shakespeare ...