Skip to Content
Deep Learning Quick Reference
book

Deep Learning Quick Reference

by Mike Bernico
March 2018
Intermediate to advanced
272 pages
7h 53m
English
Packt Publishing
Content preview from Deep Learning Quick Reference

Creating a lagged training set

For each training example, we want to train the network to predict a value xt , given a sequence of lags . The ideal number of lags is a hyperparameter, so some experimentation is in order.

Structuring the input in this way is a requirement of the BPTT algorithm, as we have previously talked about. We will use the following code to train the dataset:

def lag_dataframe(data, lags=1):    df = pd.DataFrame(data)    columns = [df.shift(i) for i in range(lags, 0, -1)]    columns.append(df)    df = pd.concat(columns, axis=1)    df.fillna(0, inplace=True)    cols = df.columns.tolist()    for i, col in enumerate(cols):        if i == 0: cols[i] ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Keras Deep Learning Cookbook

Keras Deep Learning Cookbook

Rajdeep Dua, Sujit Pal, Manpreet Singh Ghotra
Deep Learning with Keras

Deep Learning with Keras

Antonio Gulli, Sujit Pal

Publisher Resources

ISBN: 9781788837996Supplemental Content