EmbeddingLayer - (Source) - Takes positive integer indexes as input, outputs vectors. Only usable as first layer in a model. Mathematically equivalent (when bias is enabled) to DenseLayer with one-hot input, but more efficient. See also: EmbeddingSequenceLayer.

CnnLossLayer - (Source) - Used with CNNs, where a prediction must be made at each spatial location of the output (for example: segmentation or denoising). No parameters, 4d input/output with shape [minibatch, depth, height, width]. When using softmax, this is applied depthwise at each spatial location.

Cnn3DLossLayer - (Source) - used with 3D CNNs, where a preduction must be made at each spatial location (x/y/z) of the output. Layer has no parameters, 5d data in either NCDHW or NDHWC (“channels first” or “channels last”) format (configurable). Supports masking. When using Softmax, this is applied along channels at each spatial location.

CenterLossOutputLayer - (Source) - A version of OutputLayer that also attempts to minimize the intra-class distance of examples’ activations - i.e., “If example x is in class Y, ensure that embedding(x) is close to average(embedding(y)) for all examples y in Y”

Deconvolution2DLayer - (Source) - also known as transpose or fractionally strided convolutions. Can be considered a “reversed” ConvolutionLayer; output size is generally larger than the input, whilst maintaining the spatial connection structure.

GravesLSTM - (Source) - LSTM RNN with peephole connections. Does not support CuDNN (thus for GPUs, LSTM should be used in preference).

GravesBidirectionalLSTM - (Source) - A bidirectional LSTM implementation with peephole connections. Equivalent to Bidirectional(ADD, GravesLSTM). Due to addition of Bidirecitonal wrapper (below), has been deprecated on master.

Bidirectional - (Source) - A ‘wrapper’ layer - converts any standard uni-directional RNN into a bidirectional RNN (doubles number of params - forward/backward nets have independent parameters). Activations from forward/backward nets may be either added, multiplied, averaged or concatenated.

SimpleRnn - (Source) - A standard/’vanilla’ RNN layer. Usually not effective in practice with long time series dependencies - LSTM is generally preferred.

EmbeddingSequenceLayer: (Source) - A version of EmbeddingLayer that expects fixed-length number (inputLength) of integers/indices per example as input, ranged from 0 to numClasses - 1. This input thus has shape [numExamples, inputLength] or shape [numExamples, 1, inputLength]. The output of this layer is 3D (sequence/time series), namely of shape [numExamples, nOut, inputLength]. Can only be used as the first layer for a network.

StackVertex - (Source) - used to stack all inputs along the minibatch dimension. Analogous to MergeVertex, but along dimension 0 (minibatch) instead of dimension 1 (nOut/channels)

SubsetVertex - (Source) - used to get a contiguous subset of the input activations along dimension 1. For example, two SubsetVertex instances could be used to split the activations from an input array into two separate activations. Essentially the opposite of MergeVertex.

UnstackVertex - (Source) - similar to SubsetVertex, but along dimension 0 (minibatch) instead of dimension 1 (nOut/channels). Opposite of StackVertex

An InputPreProcessor is a simple class/interface that operates on the input to a layer. That is, a preprocessor is attached to a layer, and performs some operation on the input, before passing the layer to the output. Preprocessors also handle backpropagation - i.e., the preprocessing operations are generally differentiable.

Note that in many cases (such as the XtoYPreProcessor classes), users won’t need to (and shouldn’t) add these manually, and can instead just use .setInputType(InputType.feedForward(10)) or similar, which whill infer and add the preprocessors as required.

CnnToRnnPreProcessor - (Source) - handles reshaping necessary to transition from a (effectively, time distributed) CNN layer to a RNN layer.

ComposableInputPreProcessor - (Source) - simple class that allows multiple preprocessors to be chained + used on a single layer

FeedForwardToCnnPreProcessor - (Source) - handles activation reshaping to transition from a row vector (per example) to a CNN layer. Note that this transition/preprocessor only makes sense if the activations are actually CNN activations, but have been ‘flattened’ to a row vector.

IterationListener: can be attached to a model, and are called during training, once after every iteration (i.e., after each parameter update).
TrainingListener: extends IterationListener. Has a number of additional methods are called at different stages of training - i.e., after forward pass, after gradient calculation, at the start/end of each epoch, etc.

Neither type (iteration/training) are called outside of training (i.e., during output or feed-forward methods)

ND4J has a number of classes for evaluating the performance of a network, against a test set. Deeplearning4j (and SameDiff) use these ND4J evaluation classes. Different evaluation classes are suitable for different types of networks.
Note: in 1.0.0-beta3 (November 2018), all evaluation classes were moved from DL4J to ND4J; previously they were in DL4J.

EvaluationBinary - (Source) - A multi-label binary version of the Evaluation class. Each network output is assumed to be a separate/independent binary class, with probability 0 to 1 independent of all other outputs. Typically used for sigmoid + binary cross entropy networks.

EvaluationCalibration - (Source) - Used to evaluation the calibration of a binary or multi-class classifier. Produces reliability diagrams, residual plots, and histograms of probabilities. Export plots to HTML using EvaluationTools.exportevaluationCalibrationToHtmlFile method

ROC - (Source) - Used for single output binary classifiers only - i.e., networks with nOut(1) + sigmoid, or nOut(2) + softmax. Supports 2 modes: thresholded (approximate) or exact (the default). Calculates area under ROC curve, area under precision-recall curve. Plot ROC and P-R curves to HTML using EvaluationTools

ROCBinary - (Source) - a version of ROC that is used for multi-label binary networks (i.e., sigmoid + binary cross entropy), where each network output is assumed to be an independent binary variable.

ROCMultiClass - (Source) - a version of ROC that is used for multi-class (non-binary) networks (i.e., softmax + mcxent/negative-log-likelihood networks). As ROC metrics are only defined for binary classification, this treats the multi-class output as a set of ‘one-vs-all’ binary classification problems.

MultiLayerNetwork.save(File) and MultiLayerNetwork.load(File) methods can be used to save and load models. These use ModelSerializer internally. Similar save/load methods are also available for ComputationGraph.

MultiLayerNetwork and ComputationGraph can be saved using the ModelSerializer class - and specifically the writeModel, restoreMultiLayerNetwork and restoreComputationGraph methods.

Networks can be trained further after saving and loading: however, be sure to load the ‘updater’ (i.e., the historical state for updaters like momentum, ). If no futher training is required, the updater state can be ommitted to save disk space and memory.

Most Normalizers (implementing the ND4J Normalizer interface) can also be added to a model using the addNormalizerToModel method.

Note that the format used for models in DL4J is .zip: it’s possible to open/extract these files using programs supporting the zip format.

Activation functions can be defined in one of two ways:
(a) By passing an Activation enumeration value to the configuration - for example, .activation(Activation.TANH)
(b) By passing an IActivation instance - for example, .activation(new ActivationSigmoid())

Note that Deeplearning4j supports custom activation functions, which can be defined by extending BaseActivationFunction

Weight initialization refers to the method by which the initial parameters for a new network should be set.

Weight initialization are usually defined using the WeightInit enumeration.

Custom weight initializations can be specified using .weightInit(WeightInit.DISTRIBUTION).dist(new NormalDistribution(0, 1)) for example. As for master (but not 0.9.1 release) .weightInit(new NormalDistribution(0, 1)) is also possible, which is equivalent to the previous approach.

Available weight initializations. Not again that not all are available in the 0.9.1 release:

An ‘updater’ in DL4J is a class that takes raw gradients and modifies them to become updates. These updates will then be applied to the network parameters.
The CS231n course notes have a good explanation of some of these updaters.

All updaters that support a learning rate also support learning rate schedules (the Nesterov momentum updater also supports a momentum schedule). Learning rate schedules can be specified either based on the number of iterations, or the number of epochs that have elapsed. Dropout (see below) can also make use of the schedules listed here.

Configure using, for example: .updater(new Adam(new ExponentialSchedule(ScheduleType.ITERATION, 0.1, 0.99 )))
You can plot/inspect the learning rate that will be used at any point by calling ISchedule.valueAt(int iteration, int epoch) on the schedule object you have created.

L1 and L2 regularization can easily be added to a network via the configuration: .l1(0.1).l2(0.2).
Note that .regularization(true) must be enabled on 0.9.1 also (this option has been removed after 0.9.1 was released).

L1 and L2 regularization is applied by default on the weight parameters only. That is, .l1 and .l2 will not impact bias parameters - these can be regularized using .l1Bias(0.1).l2Bias(0.2).

AlphaDropout - (Source) - AlphaDropout is a dropout technique proposed by Klaumbauer et al. 2017 - Self-Normalizing Neural Networks. Designed for self-normalizing neural networks (SELU activation, NORMAL weight init). Attempts to keep both the mean and variance of the post-dropout activations to the the same (in expectation) as before alpha dropout was applied

Note that (as of current master - but not 0.9.1) the dropout parameters can also be specified according to any of the schedule classes mentioned in the Learning Rate Schedules section.

As per dropout, dropconnect / weight noise is applied only at training time

DropConnect - (Source) - DropConnect is similar to dropout, but applied to the parameters of a network (instead of the input activations). Reference

WeightNoise - (Source) - Apply noise of the specified distribution to the weights at training time. Both additive and multiplicative modes are supported - when additive, noise should be mean 0, when multiplicative, noise should be mean 1

Constraints are deterministic limitations that are placed on a model’s parameters at the end of each iteration (after the parameter update has occurred). They can be thought of as a type of regularization.

MaxNormConstraint - (Source) - Constrain the maximum L2 norm of the incoming weights for each unit to be less than or equal to the specified value. If the L2 norm exceeds the specified value, the weights will be scaled down to satisfy the constraint.

MinMaxNormConstraint - (Source) - Constrain the minimum AND maximum L2 norm of the incoming weights for each unit to be between the specified values. Weights will be scaled up/down if required.

NonNegativeConstraint - (Source) - Constrain all parameters to be non-negative. Negative parameters will be replaced with 0.

UnitNormConstraint - (Source) - Constrain the L2 norm of the incoming weights for each unit to be 1.0.

DataSetIterator is an abstraction that DL4J uses to iterate over minibatches of data, used for training. DataSetIterator returns DataSet objects, which are minibatches, and support a maximum of 1 input and 1 output array (INDArray).

MultiDataSetIterator is similar to DataSetIterator, but returns MultiDataSet objects, which can have as many input and output arrays arrays as required for the network.

These iterators download their data as required. The actual datasets they return are not customizable.

MnistDataSetIterator - (Source) - DataSetIterator for the well-known MNIST digits dataset. By default, returns a row vector (1x784), with values normalized to 0 to 1 range. Use .setInputType(InputType.convolutionalFlat()) to use with CNNs.

EmnistDataSetIterator - (Source) - Similar to the MNIST digits dataset, but with more examples, and also letters. Includes multiple different splits (letters only, digits only, letters + digits, etc). Same 1x784 format as MNIST, hence (other than different number of labels for some splits) can be used as a drop-in replacement for MnistDataSetIterator. Reference 1, Reference 2

CifarDataSetIterator - (Source) - An iterator for the CIFAR images dataset. 10 classes, 4d features/activations format for CNNs in DL4J: [minibatch,channels,height,width] = [minibatch,3,32,32]. Features are not normalized - instead, are in the range 0 to 255.

RecordReaderDataSetIterator - (Source) - an iterator that takes a DataVec record reader (such as CsvRecordReader or ImageRecordReader) and handles conversion to DataSets, batching, masking, etc. One of the most commonly used iterators in DL4J. Handles non-sequence data only, as input (i.e., RecordReader, no SequenceeRecordReader).

RecordReaderMultiDataSetIterator - (Source) - the MultiDataSet version of RecordReaderDataSetIterator, that supports multiple readers. Has a builder pattern for creating more complex data pipelines (such as different subsets of a reader’s output to different input/output arrays, conversion to one-hot, etc). Handles both sequence and non-sequence data as input.

SequenceRecordReaderDataSetIterator - (Source) - The sequence (SequenceRecordReader) version of RecordReaderDataSetIterator. Users may be better off using RecordReaderMultiDataSetIterator, in conjunction with

AsyncShieldDataSetIterator - (Source) - Generally used only for debugging. Stops MultiLayerNetwork and ComputationGraph from using an AsyncDataSetIterator.

AsyncShieldMultiDataSetIterator - (Source) - The MultiDataSetIterator version of AsyncShieldDataSetIterator

EarlyTerminationDataSetIterator - (Source) - Wraps another DataSetIterator, ensuring that only a specified (maximum) number of minibatches (DataSet) objects are returned between resets. Can be used to ‘cut short’ an iterator, returning only the first N DataSets.

EarlyTerminationMultiDataSetIterator - (Source) - The MultiDataSetIterator version of EarlyTerminationDataSetIterator

ExistingDataSetIterator - (Source) - Convert an Iterator<DataSet> or Iterable<DataSet> to a DataSetIterator. Does not split the underlying DataSet objects

FileMultiDataSetIterator - (Source) - A MultiDataSet version of FileDataSetIterator

IteratorDataSetIterator - (Source) - Convert an Iterator<DataSet> to a DataSetIterator. Unlike ExistingDataSetIterator, the underlying DataSet objects may be split/combined - i.e., the minibatch size may differ for the output, vs. the input iterator.

IteratorMultiDataSetIterator - (Source) - The Iterator<MultiDataSet> version of IteratorDataSetIterator

MultiDataSetWrapperIterator - (Source) - Convert a MultiDataSetIterator to a DataSetIterator. Note that this is only possible if the number of features and labels arrays is equal to 1.

MultipleEpochsIterator - (Source) - Treat multiple passes (epochs) of the underlying iterator as a single epoch, when training.

WorkspaceShieldDataSetIterator - (Source) - Generally used only for debugging, and not usually by users. Detaches/migrates DataSets coming out of the underlying DataSetIterator.

Create the normalizer you want to use: NormalizerMinMaxScaler normalizer = new NormalizerMinMaxScaler();

Fit the normalizer: normalizer.fit(myTrainData)

Set the normalizer/preprocessor on the iterator: myTrainData.setPreProcessor(normalizer);
End result: the data that comes from your DataSetIterator will now be normalized.

In general, you should fit only on the training data, and do trainData.setPreProcessor(normalizer) and testData.setPreProcessor(normalizer) with the same/single normalizer that has been fit on the training data only.

Note that where appropriate (NormalizerStandardize, NormalizerMinMaxScaler) statistics such as mean/standard-deviation/min/max are shared across time (for time series) and across image x/y locations (but not depth/channels - for image data).

ImagePreProcessingScaler - (Source) - Applies min-max scaling to image activations. Default settings do 0-255 input to 0-1 output (but is configurable). Note that unlike the other normalizers here, this one does not rely on statistics (mean/min/max etc) collected from the data, hence the normalizer.fit(trainData) step is unnecessary (is a no-op).

Deeplearning4j has classes/utilities for performing transfer learning - i.e., taking an existing network, and modifying some of the layers (optionally freezing others so their parameters don’t change). For example, an image classifier could be trained on ImageNet, then applied to a new/different dataset. Both MultiLayerNetwork and ComputationGraph can be used with transfer learning - frequently starting from a pre-trained model from the model zoo (see next section), though any MultiLayerNetwork/ComputationGraph can be used.

The main class for transfer learning is TransferLearning. This class has a builder pattern that can be used to add/remove layers, freeze layers, etc.
FineTuneConfiguration can be used here to specify the learning rate and other settings for the non-frozen layers.

Neural networks

Most network configurations can use MultiLayerNetwork class if they are sequential and simple.

MultiLayerConfigurationconf=newNeuralNetConfiguration.Builder().seed(1234)// parameters below are copied to every layer in the network// for inputs like dropOut() or activation() you should do this per layer// only specify the parameters you need.updater(newAdaGrad()).activation(Activation.RELU).dropOut(0.8).l1(0.001).l2(1e-4).weightInit(WeightInit.XAVIER).weightInit(Distribution.TruncatedNormalDistribution).cudnnAlgoMode(ConvolutionLayer.AlgoMode.PREFER_FASTEST).gradientNormalization(GradientNormalization.RenormalizeL2PerLayer).gradientNormalizationThreshold(1e-3).list()// layers in the network, added sequentially// parameters set per-layer override the parameters above.layer(newDenseLayer.Builder().nIn(numInputs).nOut(numHiddenNodes).weightInit(WeightInit.XAVIER).build()).layer(newActivationLayer(Activation.RELU)).layer(newConvolutionLayer.Builder(1,1).nIn(1024).nOut(2048).stride(1,1).convolutionMode(ConvolutionMode.Same).weightInit(WeightInit.XAVIER).activation(Activation.IDENTITY).build()).layer(newGravesLSTM.Builder().activation(Activation.TANH).nIn(inputNum).nOut(100).build()).layer(newOutputLayer.Builder(LossFunction.NEGATIVELOGLIKELIHOOD).weightInit(WeightInit.XAVIER).activation(Activation.SOFTMAX).nIn(numHiddenNodes).nOut(numOutputs).build()).pretrain(false).backprop(true).build();MultiLayerNetworkneuralNetwork=newMultiLayerNetwork(conf);

Complex networks

Networks that have complex graphs and “branching” such as Inception need to use ComputationGraph.

ComputationGraphConfiguration.GraphBuildergraph=newNeuralNetConfiguration.Builder().seed(seed)// parameters below are copied to every layer in the network// for inputs like dropOut() or activation() you should do this per layer// only specify the parameters you need.activation(Activation.IDENTITY).optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT).updater(updater).weightInit(WeightInit.RELU).l2(5e-5).miniBatch(true).cacheMode(cacheMode).trainingWorkspaceMode(workspaceMode).inferenceWorkspaceMode(workspaceMode).cudnnAlgoMode(cudnnAlgoMode).convolutionMode(ConvolutionMode.Same).graphBuilder()// layers in the network, added sequentially// parameters set per-layer override the parameters above// note that you must name each layer and manually specify its input.addInputs("input1").addLayer("stem-cnn1",newConvolutionLayer.Builder(newint[]{7,7},newint[]{2,2},newint[]{3,3}).nIn(inputShape[0]).nOut(64).cudnnAlgoMode(ConvolutionLayer.AlgoMode.NO_WORKSPACE).build(),"input1").addLayer("stem-batch1",newBatchNormalization.Builder(false).nIn(64).nOut(64).build(),"stem-cnn1").addLayer("stem-activation1",newActivationLayer.Builder().activation(Activation.RELU).build(),"stem-batch1").addLayer("lossLayer",newCenterLossOutputLayer.Builder().lossFunction(LossFunctions.LossFunction.SQUARED_LOSS).activation(Activation.SOFTMAX).nOut(numClasses).lambda(1e-4).alpha(0.9).gradientNormalization(GradientNormalization.RenormalizeL2PerLayer).build(),"stem-activation1").setOutputs("lossLayer").setInputTypes(InputType.convolutional(224,224,3)).backprop(true).pretrain(false).build();ComputationGraphneuralNetwork=newComputationGraph(graph);

Training

The code snippet below creates a basic pipeline that loads images from disk, applies random transformations, and fits them to a neural network. It also sets up a UI instance so you can visualize progress, and uses early stopping to terminate training early. You can adapt this pipeline for many different use cases.

ParentPathLabelGeneratorlabelMaker=newParentPathLabelGenerator();FilemainPath=newFile(System.getProperty("user.dir"),"dl4j-examples/src/main/resources/animals/");FileSplitfileSplit=newFileSplit(mainPath,NativeImageLoader.ALLOWED_FORMATS,rng);intnumExamples=Math.toIntExact(fileSplit.length());intnumLabels=fileSplit.getRootDir().listFiles(File::isDirectory).length;//This only works if your root is clean: only label subdirs.BalancedPathFilterpathFilter=newBalancedPathFilter(rng,labelMaker,numExamples,numLabels,maxPathsPerLabel);InputSplit[]inputSplit=fileSplit.sample(pathFilter,splitTrainTest,1-splitTrainTest);InputSplittrainData=inputSplit[0];InputSplittestData=inputSplit[1];booleanshuffle=false;ImageTransformflipTransform1=newFlipImageTransform(rng);ImageTransformflipTransform2=newFlipImageTransform(newRandom(123));ImageTransformwarpTransform=newWarpImageTransform(rng,42);List<Pair<ImageTransform,Double>>pipeline=Arrays.asList(newPair<>(flipTransform1,0.9),newPair<>(flipTransform2,0.8),newPair<>(warpTransform,0.5));ImageTransformtransform=newPipelineImageTransform(pipeline,shuffle);DataNormalizationscaler=newImagePreProcessingScaler(0,1);// training datasetImageRecordReaderrecordReaderTrain=newImageRecordReader(height,width,channels,labelMaker);recordReader.initialize(trainData,null);DataSetIteratortrainingIterator=newRecordReaderDataSetIterator(recordReaderTrain,batchSize,1,numLabels);// testing datasetImageRecordReaderrecordReaderTest=newImageRecordReader(height,width,channels,labelMaker);recordReader.initialize(testData,null);DataSetIteratortestingIterator=newRecordReaderDataSetIterator(recordReaderTest,batchSize,1,numLabels);// early stopping configuration, model saver, and trainerEarlyStoppingModelSaversaver=newLocalFileModelSaver(System.getProperty("user.dir"));EarlyStoppingConfigurationesConf=newEarlyStoppingConfiguration.Builder().epochTerminationConditions(newMaxEpochsTerminationCondition(50))//Max of 50 epochs.evaluateEveryNEpochs(1).iterationTerminationConditions(newMaxTimeIterationTerminationCondition(20,TimeUnit.MINUTES))//Max of 20 minutes.scoreCalculator(newDataSetLossCalculator(testingIterator,true))//Calculate test set score.modelSaver(saver).build();EarlyStoppingTrainertrainer=newEarlyStoppingTrainer(esConf,neuralNetwork,trainingIterator);// begin trainingtrainer.fit();

Complex Transformation

DataVec comes with a portable TransformProcess class that allows for more complex data wrangling and data conversion. It works well with both 2D and sequence datasets.

Schemaschema=newSchema.Builder().addColumnsDouble("Sepal length","Sepal width","Petal length","Petal width").addColumnCategorical("Species","Iris-setosa","Iris-versicolor","Iris-virginica").build();TransformProcesstp=newTransformProcess.Builder(schema).categoricalToInteger("Species").build();// do the transformation on sparkJavaRDD<List<Writable>>processedData=SparkTransformExecutor.execute(parsedInputData,tp);

We recommend having a look at the DataVec examples before creating more complex transformations.

Evaluation

Both MultiLayerNetwork and ComputationGraph come with built-in .eval() methods that allow you to pass a dataset iterator and return evaluation results.

// returns evaluation class with accuracy, precision, recall, and other class statisticsEvaluationeval=neuralNetwork.eval(testIterator);System.out.println(eval.accuracy());System.out.println(eval.precision());System.out.println(eval.recall());// ROC for Area Under Curve on multi-class datasets (not binary classes)ROCMultiClassroc=neuralNetwork.doEvaluation(testIterator,newROCMultiClass());System.out.println(roc.calculateAverageAuc());System.out.println(roc.calculateAverageAucPR());

For advanced evaluation the code snippet below can be adapted into training pipelines. This is when the built-in neuralNetwork.eval() method outputs confusing results or if you need to examine raw data.

//Evaluate the model on the test setEvaluationeval=newEvaluation(numClasses);INDArrayoutput=neuralNetwork.output(testData.getFeatures());eval.eval(testData.getLabels(),output,testMetaData);//Note we are passing in the test set metadata here//Get a list of prediction errors, from the Evaluation object//Prediction errors like this are only available after calling iterator.setCollectMetaData(true)List<Prediction>predictionErrors=eval.getPredictionErrors();System.out.println("\n\n+++++ Prediction Errors +++++");for(Predictionp:predictionErrors){System.out.println("Predicted class: "+p.getPredictedClass()+", Actual class: "+p.getActualClass()+"\t"+p.getRecordMetaData(RecordMetaData.class).getLocation());}//We can also load the raw data:List<Record>predictionErrorRawData=recordReader.loadFromMetaData(predictionErrorMetaData);for(inti=0;i<predictionErrors.size();i++){Predictionp=predictionErrors.get(i);RecordMetaDatameta=p.getRecordMetaData(RecordMetaData.class);INDArrayfeatures=predictionErrorExamples.getFeatures().getRow(i);INDArraylabels=predictionErrorExamples.getLabels().getRow(i);List<Writable>rawData=predictionErrorRawData.get(i).getRecord();INDArraynetworkPrediction=model.output(features);System.out.println(meta.getLocation()+": "+"\tRaw Data: "+rawData+"\tNormalized: "+features+"\tLabels: "+labels+"\tPredictions: "+networkPrediction);}//Some other useful evaluation methods:List<Prediction>list1=eval.getPredictions(1,2);//Predictions: actual class 1, predicted class 2List<Prediction>list2=eval.getPredictionByPredictedClass(2);//All predictions for predicted class 2List<Prediction>list3=eval.getPredictionsByActualClass(2);//All predictions for actual class 2

API Reference

API Reference

Detailed API docs for all libraries including DL4J, ND4J, DataVec, and Arbiter.

Examples

Examples

Explore sample projects and demos for DL4J, ND4J, and DataVec in multiple languages including Java and Kotlin.

Tutorials

Tutorials

Step-by-step tutorials for learning concepts in deep learning while using the DL4J API.

Guide

Guide

In-depth documentation on different scenarios including import, distributed training, early stopping, and GPU setup.

Deploying models? There's a tool for that.

Eclipse Deeplearning4j

Eclipse Deeplearning4j is an open-source, distributed deep-learning project in Java and Scala spearheaded by the people at Skymind. DL4J supports GPUs and is compatible with distributed computing software such as Apache Spark and Hadoop.