Quadratic Deep

class deepobs.pytorch.testproblems.quadratic_deep.quadratic_deep(batch_size, weight_decay=None)[source]

DeepOBS test problem class for a stochastic quadratic test problem 100dimensions. The 90 % of the eigenvalues of the Hessian are drawn from theinterval \((0.0, 1.0)\) and the other 10 % are from \((30.0, 60.0)\) simulating an eigenspectrum which has been reported for Deep Learning https://arxiv.org/abs/1611.01838.

This creatis a loss functions of the form

\(0.5* (\theta - x)^T * Q * (\theta - x)\)

with Hessian Q and "data" x coming from the quadratic data set, i.e., zero-mean normal.

Parameters:
  • batch_size (int) -- Batch size to use.
  • weight_decay (float) -- No weight decay (L2-regularization) is used in this test problem. Defaults to None and any input here is ignored.
data

The DeepOBS data set class for the quadratic problem.

loss_function

None. The output of the model is the loss.

net

The DeepOBS subclass of torch.nn.Module that is trained for this tesproblem (net_quadratic_deep).

get_batch_loss_and_accuracy_func(reduction='mean', add_regularization_if_available=True)[source]

Get new batch and create forward function that calculates loss and accuracy (if available) on that batch.

Parameters:
  • reduction (str) -- The reduction that is used for returning the loss. Can be 'mean', 'sum' or 'none' in which case each indivual loss in the mini-batch is returned as a tensor.
  • add_regularization_if_available (bool) -- If true, regularization is added to the loss.
Returns:

The function that calculates the loss/accuracy on the current batch.

Return type:

callable

set_up()[source]

Sets up the test problem.