deepaugment/objective.py
def evaluate(self, trial_no, trial_hyperparams):
        """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
        """

        augmented_data = augment_by_policy(
            self.data["X_train"], self.data["y_train"], *trial_hyperparams
        )

        sample_rewards = []
        for sample_no in range(1, self.opt_samples + 1):
            self.child_model.load_pre_augment_weights()
            # TRAIN
            history = self.child_model.fit(self.data, augmented_data)
            #
            reward = self.calculate_reward(history)
            sample_rewards.append(reward)
            self.notebook.record(
                trial_no, trial_hyperparams, sample_no, reward, history
            )

        trial_cost = 1 - np.mean(sample_rewards)
        self.notebook.save()

        log_and_print(
            f"{str(trial_no)}, {str(trial_cost)}, {str(trial_hyperparams)}",
            self.logging,
        )

        return trial_cost
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
        
Evaluates objective function
Trains the child model k times with same augmentation hyperparameters.
k is determined by the user by `opt_samples` argument.

trial_no (int): no of trial. needed for recording to notebook
trial_hyperparams (list)
Returns:
float: trial-cost = 1 - avg. rewards from samples
Evaluates objective function Trains the child model k times with same augmentation hyperparameters . k is determined by the user by ` opt_samples ` argument . trial_no ( int ) : no of trial . needed for recording to notebook trial_hyperparams ( list ) Returns : float : trial - cost = 1 - avg . rewards from samples
def evaluate(self, trial_no, trial_hyperparams):
        augmented_data = augment_by_policy(
            self.data["X_train"], self.data["y_train"], *trial_hyperparams
        )
        sample_rewards = []
        for sample_no in range(1, self.opt_samples + 1):
            self.child_model.load_pre_augment_weights()
            history = self.child_model.fit(self.data, augmented_data)
            reward = self.calculate_reward(history)
            sample_rewards.append(reward)
            self.notebook.record(
                trial_no, trial_hyperparams, sample_no, reward, history
            )
        trial_cost = 1 - np.mean(sample_rewards)
        self.notebook.save()
        log_and_print(
            f"{str(trial_no)}, {str(trial_cost)}, {str(trial_hyperparams)}",
            self.logging,
        )
        return trial_cost
def evaluate ( self , trial_no , trial_hyperparams ) : augmented_data = augment_by_policy ( self . data [ "X_train" ] , self . data [ "y_train" ] , * trial_hyperparams ) sample_rewards = [ ] for sample_no in range ( 1 , self . opt_samples + 1 ) : self . child_model . load_pre_augment_weights ( ) history = self . child_model . fit ( self . data , augmented_data ) reward = self . calculate_reward ( history ) sample_rewards . append ( reward ) self . notebook . record ( trial_no , trial_hyperparams , sample_no , reward , history ) trial_cost = 1 - np . mean ( sample_rewards ) self . notebook . save ( ) log_and_print ( f"{str(trial_no)}, {str(trial_cost)}, {str(trial_hyperparams)}" , self . logging , ) return trial_cost
Evaluates objective function
Trains the child model k times with same augmentation hyperparameters.
Evaluates objective function Trains the child model k times with same augmentation hyperparameters .
"""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
        """ # TRAIN #
self
trial_no
trial_hyperparams