How to do it…

  1. Next, let's define the parameters to be used in our simple network, as well as the DataFrame where we are going to store the results, as follows:
n_lag = 1n_repeats = 30n_epochs = 1000n_batch = 4n_neurons = 3results = DataFrame()
  1. We then call the experiment method as follows:
results['results'] = experiment(series, n_lag, n_repeats, n_epochs, n_batch, n_neurons)

Inside the experiment() method, we are processing the data through the network as follows:

def experiment(series, n_lag, n_repeats, n_epochs, n_batch, n_neurons):  # method details ....
  1. First, we get values of the series DataFrame, as follows:
raw_values = series.valuesdiff_values = difference(raw_values, 1)

The output of raw_values and diff values is as follows: ...

Get Keras Deep Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.