dopt.nnet

This package contains a deep learning API backed by dopt.

Working examples for how this package can be used are given in the examples/mnist.d and examples/cifar10.d files.

One would generally start by using UFCS to define a feed-forward network:

auto features = float32([128, 1, 28, 28]);

auto layers = dataSource(features)
             .dense(2_000)
             .relu()
             .dense(2_000)
             .relu()
             .dense(10)
             .softmax();

The DAGNetwork class can then be used to traverse the resulting graph and aggregate parameters/loss terms:

auto network = new DAGNetwork([features], [layers]);

After this, one can define an objective function---there are a few standard loss functions implemented in dopt.nnet.losses:

auto labels = float32([128, 10]);

auto trainLoss = crossEntropy(layers.trainOutput, labels) + network.paramLoss;

where network.paramLoss is the sum of any parameter regularisation terms. The dopt.online package can be used to construct an updater:

auto updater = sgd([trainLoss], network.params, network.paramProj);

Finally, one can call this updater with some actual training data:

updater([
    features: Buffer(some_real_features),
    labels: Buffer(some_real_labels)
]);

Modules

data
module dopt.nnet.data
Undocumented in source.
layers
module dopt.nnet.layers

Contains generic utilities for working with Layer objects.

lipschitz
module dopt.nnet.lipschitz

Contains an implementation of the regularisation techniques presented in Gouk et al. (2018).

losses
module dopt.nnet.losses

Contains some utilities for constructing graphs for common loss functions.

models
module dopt.nnet.models
Undocumented in source.
networks
module dopt.nnet.networks

Provides a useful tools for constructing neural networks.

parameters
module dopt.nnet.parameters

This module contains methods for initialising the parameters of neural networks.

util
module dopt.nnet.util
Undocumented in source.

Public Imports

dopt.nnet.data
public import dopt.nnet.data;
dopt.nnet.layers
public import dopt.nnet.layers;
dopt.nnet.lipschitz
public import dopt.nnet.lipschitz;
dopt.nnet.losses
public import dopt.nnet.losses;
dopt.nnet.models
public import dopt.nnet.models;
dopt.nnet.networks
public import dopt.nnet.networks;
dopt.nnet.parameters
public import dopt.nnet.parameters;

Meta

Authors

Henry Gouk