(self, model)
return results
Evaluates the model on the given metrics for a dataset.
        Returns: A dict containing all the metrics
Evaluates the model on the given metrics for a dataset.
        Returns: A dict containing all the metrics
Evaluates the model on the given metrics for a dataset . Returns : A dict containing all the metrics
def evaluate(self, model):
        """
        Evaluates the model on the given metrics for a dataset.
        Returns: A dict containing all the metrics
        """
        self.data_iter.init_epoch()
        model.eval()
        for m in self.metrics:
            m.reset()

        total_loss = 0

        prog_iter = tqdm(self.data_iter, leave=False)
        with torch.no_grad():
            for batch in prog_iter:
                loss, predictions = model.loss(batch, compute_predictions=True)
                for m in self.metrics:
                    m.evaluate(batch, loss, predictions)
                total_loss += float(loss)
                
                prog_iter.set_description('Evaluating')
            
            results = {'loss': total_loss/len(self.data_iter)}
            for m in self.metrics:
                r = m.results(total_loss)
                if not isinstance(r, dict):
                    raise ValueError('{}.results() should return a dict containing metrics'.format(m.__class__.__name__))
                results.update(r)

        return results
def evaluate ( self , model ) : self . data_iter . init_epoch ( ) model . eval ( ) for m in self . metrics : m . reset ( ) total_loss = 0 prog_iter = tqdm ( self . data_iter , leave = False ) with torch . no_grad ( ) : for batch in prog_iter : loss , predictions = model . loss ( batch , compute_predictions = True ) for m in self . metrics : m . evaluate ( batch , loss , predictions ) total_loss += float ( loss ) prog_iter . set_description ( 'Evaluating' ) results = { 'loss' : total_loss / len ( self . data_iter ) } for m in self . metrics : r = m . results ( total_loss ) if not isinstance ( r , dict ) : raise ValueError ( '{}.results() should return a dict containing metrics' . format ( m . __class__ . __name__ ) ) results . update ( r ) return results