objective module

class deepaugment.objective.Objective(data, child_model, notebook, config)[source]

Bases: object

Objective class for the controller

calculate_reward(history)[source]

Calculates reward for the history.

Reward is mean of largest n validation accuracies which are not overfitting. n is determined by the user by opt_last_n_epochs argument. A validation accuracy is considered as overfitting if the training accuracy in the same epoch is larger by 0.05

Args:
history (dict): dictionary of loss and accuracy
Returns:
float: reward
evaluate(trial_no, trial_hyperparams)[source]

Evaluates objective function

Trains the child model k times with same augmentation hyperparameters. k is determined by the user by opt_samples argument.

Args:
trial_no (int): no of trial. needed for recording to notebook trial_hyperparams (list)
Returns:
float: trial-cost = 1 - avg. rewards from samples