(self, out, saving_criteria)
return False
Verify if the last model is the best for a specific saving criteria

            Args:
                out(dict): mean of all the scalar outputs of model indexed by output name
                saving_criteria(str):

            Returns:
                is_best(bool)

            Example usage:

            .. code-block:: python

                out = {
                    'loss': 0.2,
                    'acctop1': 87.02
                }

                engine.is_best(out, 'loss:min')
Verify if the last model is the best for a specific saving criteria
Verify if the last model is the best for a specific saving criteria
def is_best(self, out, saving_criteria):
        """ Verify if the last model is the best for a specific saving criteria

            Args:
                out(dict): mean of all the scalar outputs of model indexed by output name
                saving_criteria(str):

            Returns:
                is_best(bool)

            Example usage:

            .. code-block:: python

                out = {
                    'loss': 0.2,
                    'acctop1': 87.02
                }

                engine.is_best(out, 'loss:min')
        """
        if ':min' in saving_criteria:
            name = saving_criteria.replace(':min', '')
            order = '<'
        elif ':max' in saving_criteria:
            name = saving_criteria.replace(':max', '')
            order = '>'
        else:
            error_msg = """'--engine.saving_criteria' named '{}' does not specify order,
            you need to chose between '{}' or '{}' to specify if the criteria needs to be minimize or maximize""".format(
                saving_criteria, saving_criteria + ':min', saving_criteria + ':max')
            raise ValueError(error_msg)

        if name not in out:
            raise KeyError("'--engine.saving_criteria' named '{}' not in outputs '{}'".format(name, list(out.keys())))

        if name not in self.best_out:
            self.best_out[name] = out[name]
            return True
        else:
            if eval('{} {} {}'.format(out[name], order, self.best_out[name])):
                self.best_out[name] = out[name]
                return True

        return False
def is_best ( self , out , saving_criteria ) : if ':min' in saving_criteria : name = saving_criteria . replace ( ':min' , '' ) order = '<' elif ':max' in saving_criteria : name = saving_criteria . replace ( ':max' , '' ) order = '>' else : error_msg = """'--engine.saving_criteria' named '{}' does not specify order,
            you need to chose between '{}' or '{}' to specify if the criteria needs to be minimize or maximize""" . format ( saving_criteria , saving_criteria + ':min' , saving_criteria + ':max' ) raise ValueError ( error_msg ) if name not in out : raise KeyError ( "'--engine.saving_criteria' named '{}' not in outputs '{}'" . format ( name , list ( out . keys ( ) ) ) ) if name not in self . best_out : self . best_out [ name ] = out [ name ] return True else : if eval ( '{} {} {}' . format ( out [ name ] , order , self . best_out [ name ] ) ) : self . best_out [ name ] = out [ name ] return True return False