Book Image

Java Deep Learning Projects

Book Image

Java Deep Learning Projects

Overview of this book

Java is one of the most widely used programming languages. With the rise of deep learning, it has become a popular choice of tool among data scientists and machine learning experts. Java Deep Learning Projects starts with an overview of deep learning concepts and then delves into advanced projects. You will see how to build several projects using different deep neural network architectures such as multilayer perceptrons, Deep Belief Networks, CNN, LSTM, and Factorization Machines. You will get acquainted with popular deep and machine learning libraries for Java such as Deeplearning4j, Spark ML, and RankSys and you’ll be able to use their features to build and deploy projects on distributed computing environments. You will then explore advanced domains such as transfer learning and deep reinforcement learning using the Java ecosystem, covering various real-world domains such as healthcare, NLP, image classification, and multimedia analytics with an easy-to-follow approach. Expert reviews and tips will follow every project to give you insights and hacks. By the end of this book, you will have stepped up your expertise when it comes to deep learning in Java, taking it beyond theory and be able to build your own advanced deep learning systems.
Table of Contents (13 chapters)

Playing the GridWorld game

For this project, I haven't used any visualization to demonstrate the states and actions. Rather it is a text-based game, as I alluded to earlier. Then you can run the GridWorld.java class (containing the main method) using following invocation:

DeepQNetwork RLNet = new DeepQNetwork(conf, 100000, .99f, 1d, 1024, 500, 1024, InputLength, 4);

In this invocation, here's the parameter description outlined:

  • conf: This is the MultiLayerConfiguration used to create the DQN
  • 100000: This is the replay memory capacity
  • .99f: The discount
  • 1d: This is the epsilon
  • 1024: The batch size
  • 500: This is the update frequency; second 1,024 is the replay start size
  • InputLength: This is the input length of size x size x 2 + 1= 33 (considering size=4)
  • 4: This is the number of possible actions that can be performed by the agent.

We initialize epsilon (ϵ-greedy...