MNIST MLP

class deepobs.mnist.mnist_mlp.set_up(batch_size, weight_decay=None)[source]

Class providing the functionality for a multi-layer perceptron architecture on MNIST.

It consists of four fully-connected layers, with 1000, 500, 100 and 10 (output) units per layer. The first three layer use ReLU activations, and the output layer the softmax activation. The biases are initialized to 0.0 and the weight matrices with truncated normal (stddev= 3e-2). The model uses a cross entropy loss.

Parameters:
  • batch_size (int) -- Batch size of the data points. No default value is defined.
  • weight_decay (float) -- Weight decay factor. In this model there is no weight decay implemented. Defaults to None.
data_loading

Data loading class for MNIST, mnist_input.data_loading.

Type:deepobs.data_loading
losses

Tensor of size batch_size containing the individual losses per data point.

Type:tf.Tensor
accuracy

Tensor containing the accuracy of the model.

Type:tf.Tensor
train_init_op

A TensorFlow operation to be performed before starting every training epoch.

Type:tf.Operation
train_eval_init_op

A TensorFlow operation to be performed before starting every training eval epoch.

Type:tf.Operation
test_init_op

A TensorFlow operation to be performed before starting every test evaluation phase.

Type:tf.Operation
bias_variable(name, shape, init_val)[source]

Creates a bias variable of given shape and initialized to a given value.

Parameters:
  • name (str) -- Name of the bias variable.
  • shape (list) -- Dimensionality of the bias variable.
  • init_val (float) -- Initial value of the bias variable.
Returns:

Bias variable.

Return type:

tf.Variable

get()[source]

Returns the losses and the accuray of the model.

Returns:Tupel consisting of the losses and the accuracy.
Return type:tupel
set_up(weight_decay)[source]

Returns the losses and the accuray of the model.

Parameters:weight_decay (float) -- Weight decay factor. In this model there is no weight decay implemented. Defaults to None.
Returns:Tupel consisting of the losses and the accuracy.
Return type:tupel
weight_variable(name, shape, init_stddev)[source]

Creates a weight variable, initialized by a truncated normal of stdev= 0.05.

Parameters:
  • name (str) -- Name of the weight variable.
  • shape (list) -- Dimensionality of the weight variable.
  • init_stddev (float) -- Standard deviation of the truncated normal to initialize the weight variable.
Returns:

Weight variable.

Return type:

tf.Variable