Skip to content

Instantly share code, notes, and snippets.

@andrewm4894
Created January 23, 2019 21:17
Show Gist options
  • Save andrewm4894/4540e23d86fa02859191a38998661849 to your computer and use it in GitHub Desktop.
Save andrewm4894/4540e23d86fa02859191a38998661849 to your computer and use it in GitHub Desktop.
import numpy as np
import pandas as pd
from numpy import concatenate
from matplotlib import pyplot
from keras.models import Sequential
from keras.callbacks import Callback
from keras.layers import LSTM, Dense, Activation
import matplotlib.pyplot as plt
%matplotlib inline
N_DATA_ORIG = 3000 # length of data to generate
N_FEATURES = 5 # number of syntethic features to create
N_ROLLING = 1000 # length of window over which to smooth the random data to make it look realistic
N_TIMESTEPS = 5 # number of timesteps you want to both train on and predict out to
N_DATA = N_DATA_ORIG - N_ROLLING # length of final data after smoothing
N_TRAIN_ITERATIONS = 5 # number of times to iterate training of the model
N_EPOCHS = 5 # within each train call how many epochs to run for
BATCH_SIZE = 100 # batch size to train on
N_LAYERS = 3 # number of layers for the LSTM
N_LSTM_UNITS = 2 # number of hidden unit in each LSTM layer
BREAK_LEN = 1000 # length of the break in the data we will create
random_break_point = np.random.choice(N_DATA) # pick a random point in the data to swap in the broken data into
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment