Deeplearning4j
Community ForumND4J JavadocDL4J Javadoc
EN 1.0.0-beta6
EN 1.0.0-beta6
  • Eclipse DeepLearning4J
  • Getting Started
    • Quickstart
    • Tutorials
      • Quickstart with MNIST
      • MultiLayerNetwork And ComputationGraph
      • Logistic Regression
      • Built-in Data Iterators
      • Feed Forward Networks
      • Basic Autoencoder
      • Advanced Autoencoder
      • Convolutional Networks
      • Recurrent Networks
      • Early Stopping
      • Layers and Preprocessors
      • Hyperparameter Optimization
      • Using Multiple GPUs
      • Clinical Time Series LSTM
      • Sea Temperature Convolutional LSTM
      • Sea Temperature Convolutional LSTM 2
      • Instacart Multitask Example
      • Instacart Single Task Example
      • Cloud Detection Example
    • Core Concepts
    • Cheat Sheet
    • Examples Tour
    • Deep Learning Beginners
    • Build from Source
    • Contribute
      • Eclipse Contributors
    • Benchmark Guide
    • About
    • Release Notes
  • Configuration
    • Backends
      • CPU and AVX
      • cuDNN
      • Performance Issues
    • Memory Management
      • Memory Workspaces
    • Snapshots
    • Maven
    • SBT, Gradle, & Others
  • Models
    • Autoencoders
    • Multilayer Network
    • Computation Graph
    • Convolutional Neural Network
    • Recurrent Neural Network
    • Layers
    • Vertices
    • Iterators
    • Listeners
    • Custom Layers
    • Model Persistence
    • Activations
    • Updaters
  • Model Zoo
    • Overview
    • Zoo Models
  • ND4J
    • Overview
    • Quickstart
    • Backend
    • Basics
    • Elementwise Operations
    • Matrix Manipulation
    • Syntax
    • Tensors
  • SAMEDIFF
    • Importing TensorFlow models
    • Variables
    • Ops
    • Adding Ops
  • Tuning & Training
    • Evaluation
    • Visualization
    • Trouble Shooting
    • Early Stopping
    • t-SNE Visualization
    • Transfer Learning
  • DISTRIBUTED DEEP LEARNING
    • Introduction/Getting Started
    • Technical Explanation
    • Spark Guide
    • Spark Data Pipelines Guide
    • API Reference
    • Parameter Server
  • Keras Import
    • Overview
    • Get Started
    • Supported Features
      • Activations
      • Losses
      • Regularizers
      • Initializers
      • Constraints
      • Optimizers
    • Functional Model
    • Sequential Model
    • API Reference
      • Core Layers
      • Convolutional Layers
      • Embedding Layers
      • Local Layers
      • Noise Layers
      • Normalization Layers
      • Pooling Layers
      • Recurrent Layers
      • Wrapper Layers
      • Advanced Activations
  • Arbiter
    • Overview
    • Layer Spaces
    • Parameter Spaces
  • Datavec
    • Overview
    • Records
    • Reductions
    • Schema
    • Serialization
    • Transforms
    • Analysis
    • Readers
    • Conditions
    • Executors
    • Filters
    • Operations
    • Normalization
    • Visualization
  • Language Processing
    • Overview
    • Word2Vec
    • Doc2Vec
    • Sentence Iteration
    • Tokenization
    • Vocabulary Cache
  • Mobile (Android)
    • Setup
    • Tutorial: First Steps
    • Tutorial: Classifier
    • Tutorial: Image Classifier
  • FAQ
  • Press
  • Support
  • Why Deep Learning?
Powered by GitBook
On this page
  • Survey of DeepLearning4j Examples
  • DataVec examples
  • IrisAnalysis.java
  • BasicDataVecExample.java
  • PrintSchemasAtEachStep.java
  • JoinExample.java
  • LogDataExample.java
  • MnistImagePipelineExample.java
  • PreprocessNormalizerExample.java
  • CSVExampleEvaluationMetaData.java
  • DeepLearning4J Examples
  • MNIST dataset of handwritten digits
  • MLPMnistSingleLayerExample.java
  • MLPMnistTwoLayerExample.java
  • Feedforward Examples
  • Convolutional Neural Networks
  • AnimalsClassification.java
  • Saving and Loading Models
  • SaveLoadComputationGraph.java
  • SaveLoadMultiLayerNetwork.java
  • Saving/loading a trained model and passing it new input
  • Custom Loss Functions and Layers
  • CustomLossExample.java
  • CustomLossL1L2.java
  • Custom Layer
  • CustomLayerExample.java
  • Natural Language Processing
  • Paragraph Vectors
  • Sequence Vectors
  • Word2Vec
  • Data Visualization
  • Recurrent Neural Networks
  • BasicRNNExample.java
  • LSTMCharModellingExample.java
  • AdditionRNN.java
  • RegressionMathFunctions.java
  • UCISequenceClassificationExample.java
  • VideoClassificationExample.java
  • SentimentExampleIterator.java
  • Distributed Training on Spark
  • MnistMLPExample.java
  • SparkLSTMCharacterExample.java
  • ND4J Examples
  • Basic ND4J examples
  • Reinforcement Learning Examples

Was this helpful?

Edit on Git
Export as PDF
  1. Getting Started

Examples Tour

Brief tour of available examples in DL4J.

PreviousCheat SheetNextDeep Learning Beginners

Last updated 4 years ago

Was this helpful?

To access examples as they were during the beta6 release, please use this version of the example repository:

Survey of DeepLearning4j Examples

Deeplearning4j's Github repository has many examples to cover its functionality. The shows you how to set up Intellij and clone the repository. This page provides an overview of some of those examples.

DataVec examples

Most of the examples make use of DataVec, a toolkit for preprocessing and clearing data through normalization, standardization, search and replace, column shuffles and vectorization. Reading raw data and transforming it into a DataSet object for your Neural Network is often the first step toward training that network. If you're unfamiliar with DataVec, here is a description and some links to useful examples.

IrisAnalysis.java

This example takes the canonical Iris dataset of the flower species of the same name, whose relevant measurements are sepal length, sepal width, petal length and petal width. It builds a Spark RDD from the relatively small dataset and runs an analysis against it.

BasicDataVecExample.java

This example loads data into a Spark RDD. All DataVec transform operations use Spark RDDs. Here, we use DataVec to filter data, apply time transformations and remove columns.

PrintSchemasAtEachStep.java

This example shows the print Schema tools that are useful to visualize and to ensure that the code for the transform is behaving as expected.

JoinExample.java

You may need to join datasets before passing to a neural network. You can do that in DataVec, and this example shows you how.

LogDataExample.java

This is an example of parsing log data using DataVec. The obvious use cases are cybersecurity and customer relationship management.

MnistImagePipelineExample.java

This example is from the video below, which demonstrates the ParentPathLabelGenerator and ImagePreProcessing scaler.

PreprocessNormalizerExample.java

This example demonstrates preprocessing features available in DataVec.

CSVExampleEvaluationMetaData.java

DataMeta data tracking - i.e. seeing where data for each example comes from - is useful when tracking down malformed data that causes errors and other issues. This example demonstrates the functionality in the RecordMetaData class.

DeepLearning4J Examples

To build a neural net, you will use either MultiLayerNetwork or ComputationGraph. Both options work using a Builder interface. A few highlights from the examples are described below.

MNIST dataset of handwritten digits

MNIST is the "Hello World" of deep learning. Simple, straightforward, and focused on image recognition, a task that Neural Networks do well.

MLPMnistSingleLayerExample.java

This is a Single Layer Perceptron for recognizing digits. Note that this pulls the images from a binary package containing the dataset, a rather special case for data ingestion.

MLPMnistTwoLayerExample.java

A two-layer perceptron for MNIST, showing there is more than one useful network for a given dataset.

Feedforward Examples

Data flows through feed-forward neural networks in a single pass from input via hidden layers to output.

These networks can be used for a wide range of tasks depending on they are configured. Along with image classification over MNIST data, this directory has examples demonstrating regression, classification, and anomaly detection.

Convolutional Neural Networks

Convolutional Neural Networks are mainly used for image recognition, although they apply to sound and text as well.

AnimalsClassification.java

This example can be run using either LeNet or AlexNet.

Saving and Loading Models

Training a network over a large volume of training data takes time. Fortunately, you can save a trained model and load the model for later training or inference.

SaveLoadComputationGraph.java

This demonstrates saving and loading a network build using the class ComputationGraph.

SaveLoadMultiLayerNetwork.java

Demonstrates saving and loading a Neural Network built with the class MultiLayerNetwork.

Saving/loading a trained model and passing it new input

Our video series shows code that includes saving and loading models, as well as inference.

Custom Loss Functions and Layers

Do you need to add a Loss Function that is not available or prebuilt yet? Check out these examples.

CustomLossExample.java

CustomLossL1L2.java

Custom Layer

Do you need to add a layer with features that aren't available in DeepLearning4J core? This example show where to begin.

CustomLayerExample.java

Natural Language Processing

Neural Networks for NLP? We have those, too.

Paragraph Vectors

Sequence Vectors

One way to represent sentences is as a sequence of words.

Word2Vec

Data Visualization

t-Distributed Stochastic Neighbor Embedding (t-SNE) is useful for data visualization. We include an example in the NLP section since word similarity visualization is a common use.

Recurrent Neural Networks

Recurrent Neural Networks are useful for processing time series data or other sequentially fed data like video.

The examples folder for Recurrent Neural Networks has the following:

BasicRNNExample.java

An RNN learns a string of characters.

LSTMCharModellingExample.java

Takes the complete works of Shakespeare as a sequence of characters and Trains a Neural Net to generate "Shakespeare" one character at a time.

AdditionRNN.java

This example trains a neural network to do addition.

RegressionMathFunctions.java

This example trains a neural network to perform various math operations.

UCISequenceClassificationExample.java

A publicly available dataset of time series data of six classes, cyclic, up-trending, etc. Example of an RNN learning to classify the time series.

VideoClassificationExample.java

How do autonomous vehicles distinguish between a pedestrian, a stop sign and a green light? A complex neural net using Convolutional and Recurrent layers is trained on a set of training videos. The trained network is passed live onboard video and decisions based on object detection from the Neural Net determine the vehicles actions.

This example is similar, but simplified. It combines convolutional, max pooling, dense (feed forward) and recurrent (LSTM) layers to classify frames in a video.

SentimentExampleIterator.java

This sentiment analysis example classifies sentiment as positive or negative using word vectors and a Recurrent Neural Network.

Distributed Training on Spark

DeepLearning4j supports using a Spark Cluster for network training. Here are the examples.

MnistMLPExample.java

This is an example of a Multi-Layer Perceptron training on the Mnist data set of handwritten digits.

SparkLSTMCharacterExample.java

An LSTM recurrent Network in Spark.

ND4J Examples

ND4J is a tensor processing library. It can be thought of as Numpy for the JVM. Neural Networks work by processing and updating MultiDimensional arrays of numeric values. In a typical Neural Net application you use DataVec to ingest and convert the data to numeric. Classes used would be RecordReader. Once you need to pass data into a Neural Network, you typically use RecordReaderDataSetIterator. RecordReaderDataSetIterator returns a DataSet object. DataSet consists of an NDArray of the input features and an NDArray of the labels.

The learning algorithms and loss functions are executed as ND4J operations.

Basic ND4J examples

This is a directory with examples for creating and manipulating NDArrays.

Reinforcement Learning Examples

Deep learning algorithms have learned to play Space Invaders and Doom using reinforcement learning. DeepLearning4J/RL4J examples of Reinforcement Learning are available here:

A vectorized representation of words. Described

Described

https://github.com/eclipse/deeplearning4j-examples/tree/a4594ba7508a3ab1342b3390a3f8354f6c754ee1
Quick Start Guide
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Our YouTube channel
Show me the code
Show me the code
Show me the code
here
Show me the code
Show me the code
here
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code
Show me the code