2D Beale¶
-
class
deepobs.two_d.noisy_beale.set_up(batch_size=128, size=1000, noise_level=6, starting_point=[-4.5, 4.5], weight_decay=None)[source]¶ Simple 2D Noisy Beale Loss Function:
\(((1.5 - u + u \cdot v)^2 + X \cdot (2.25 - u + u \cdot v ^ 2) ^ 2 + y \cdot (2.625 - u + u \cdot v ^ 3) ^ 2)\)where X and Y are normally distributed with mean 1.0 and sigma given by the noise_level.
Parameters: - batch_size (int) -- Batch size of the data points. Defaults to
128. - size (int) -- Size of the training set. Defaults to
1000. - 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
6.0. - starting_point (list) -- Coordinates of the starting point of the optimization process. Defaults to
[-4.5, 4.5]. - weight_decay (float) -- Weight decay factor. In this model there is no weight decay implemented. Defaults to
None.
-
data_loading¶ Data loading class for 2D functions,
two_d_input.data_loading.Type: deepobs.data_loading
-
losses¶ Tensor of size
batch_sizecontaining 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
-
anim_run(u_history, v_history, loss_history, name='Optimizer Trajectory')[source]¶ Animate the history of weights (u, v) and the corresponding loss of an optimizer. Plot the deterministic Beale as well.
Parameters: - u_history (list) -- List of
uvalues (first parameter) as passed by the optimizer. - v_history (list) -- List of
vvalues (second parameter) as passed by the optimizer. - loss_history (list) -- List of
lossvalues as passed by the optimizer. Could be train or test loss. - name (str) -- Name of the optimizer. Defaults to "Optimizer Trajectory".
Returns: Animation object showing the optimizer's trajectory per iteration.
Return type: matplotlib.animation.FuncAnimation
- u_history (list) -- List of
-
beale(u, v)[source]¶ Deterministic version of Beale function.
Parameters: - u (float) -- Coordinate of the first parameter.
- v (float) -- Coordinate of the second parameter.
Returns: Function value of the deterministic Beale function at
(u,v).Return type: float
-
get()[source]¶ Returns the losses and the accuray of the model.
Returns: Tupel consisting of the losses and the accuracy. Return type: tupel
-
plot_run(u_history, v_history, loss_history)[source]¶ Plot the history of weights (u, v) and the corresponding loss of an optimizer. Plot the Deterministic Beale as well.
Parameters: - u_history (list) -- List of
uvalues (first parameter) as passed by the optimizer. - v_history (list) -- List of
vvalues (second parameter) as passed by the optimizer. - loss_history (list) -- List of
lossvalues as passed by the optimizer. Could be train or test loss.
Returns: Plot with the deterministic beale and the optimizers trajectory.
Return type: fig
- u_history (list) -- List of
-
set_up(starting_point=[-4.5, 4.5], weight_decay=None)[source]¶ Sets up the test problem.
Parameters: - starting_point (list) -- Coordinates of the starting point of the optimization process. Defaults to
[-4.5, 4.5]. - 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
- starting_point (list) -- Coordinates of the starting point of the optimization process. Defaults to
- batch_size (int) -- Batch size of the data points. Defaults to