Skip to Content
Java Deep Learning Projects
book

Java Deep Learning Projects

by Md. Rezaul Karim
June 2018
Intermediate to advanced
436 pages
10h 33m
English
Packt Publishing
Content preview from Java Deep Learning Projects

Network training, and saving the trained model

Now that our network as well as the training and test sets are ready, we can start training the network. For this, again we use the DL4J-provided fit() method. We loop through epochs times, for each time looping until we have the data. We fit the network with a miniBatchSize amount of data at each time step, as shown here:

// StockPricePrediction.javaSystem.out.println("Training LSTM network...");for(int i = 0; i < epochs; i++) {            while(iterator.hasNext()) net.fit(iterator.next()); // fit model using mini-batch data            iterator.reset(); // reset iterator            net.rnnClearPreviousState(); // clear previous state        }>> Creating dataSet iterator... Loading test dataset... Building LSTM networks... Training ...
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

Java Deep Learning Essentials

Java Deep Learning Essentials

Yusuke Sugomori
Machine Learning in Java - Second Edition

Machine Learning in Java - Second Edition

AshishSingh Bhatia, Bostjan Kaluza
Mastering Java Machine Learning

Mastering Java Machine Learning

Uday Kamath, Krishna Choppella

Publisher Resources

ISBN: 9781788997454Supplemental Content