Noisy Quadratic

class deepobs.quadratic.noisy_quadratic.set_up(batch_size=128, size=1000, Q=None, noise_level=3.0, weight_decay=None)[source]

Simple N-Dimensional Noisy Quadratic Problem

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

where x is normally distributed with mean 0.0 and sigma given by the noise_level (default is 3.0).

Parameters:
  • batch_size (int) -- Batch size of the data points. Defaults to 128.
  • size (int) -- Size of the training set. Defaults to 1000.
  • Q (np.array) -- Matrix defining the quadratic problem. Input can either be a matrix or a vector (eigenvalues). If a vector is given, we use the randomly rotated matrix with those eigenvalues. Defaults to None, which uses a vector with 90 values drawn uniform at random from (0,1) and 10 drawn uniformly from (30, 60).
  • noise_level (float) -- Noise level of the training set. All training points are sampled from a gaussian distribution with the noise level as the standard deviation. Defaults to 3.0.
  • weight_decay (float) -- Weight decay factor. In this model there is no weight decay implemented. Defaults to None.
data_loading

Data loading class for quadratic problems, quadratic_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. As there is no accuracy when the loss function is given directly, we set it to 0.

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
get()[source]

Returns the losses and the accuray of the model.

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

Produces a rotation matrix R in SO(D) (the special orthogonal group SO(D), or orthogonal matrices with unit determinant, drawn uniformly from the Haar measure. The algorithm used is the subgroup algorithm as originally proposed by P. Diaconis & M. Shahshahani, "The subgroup algorithm for generating uniform random variables". Probability in the Engineering and Informational Sciences 1: 15?32 (1987)

Parameters:D (int) -- Dimensionality of the matrix.
Returns:Random rotation matrix R.
Return type:np.array
set_up(Q, weight_decay=None)[source]

Sets up the test problem.

Parameters:
  • Q (np.array) -- Matrix defining the quadratic problem. Input can either be a matrix or a vector (eigenvalues). If a vector is given, we use the randomly rotated matrix with those eigenvalues. Defaults to None, which uses a vector with 90 values drawn uniform at random from (0,1) and 10 drawn uniformly from (30, 60).
  • 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