(self, metrics, save=False)
eval metrics
eval metrics
eval metrics
def log_eval_metrics(self, metrics, save=False):
    ''' eval metrics '''
    logging.info('Eval Result:')
    if save:
      fobj = open(self.eval_metrics_path, 'w')
    for key, value in metrics.items():
      logging.info("{}: {}".format(key, value))
      if save:
        fobj.write("{}: {}\n".format(key, value))
    if 'tp' in metrics and 'fp' in metrics and 'fn' in metrics and 'tn' in metrics:
      f1_score = metrics_lib.f1_score(metrics['tp'], metrics['fp'],
                                      metrics['fn'], metrics['tn'])
      logging.info("F1: {}".format(f1_score))
      if save:
        fobj.write("F1: {}\n".format(f1_score))
def log_eval_metrics ( self , metrics , save = False ) : logging . info ( 'Eval Result:' ) if save : fobj = open ( self . eval_metrics_path , 'w' ) for key , value in metrics . items ( ) : logging . info ( "{}: {}" . format ( key , value ) ) if save : fobj . write ( "{}: {}\n" . format ( key , value ) ) if 'tp' in metrics and 'fp' in metrics and 'fn' in metrics and 'tn' in metrics : f1_score = metrics_lib . f1_score ( metrics [ 'tp' ] , metrics [ 'fp' ] , metrics [ 'fn' ] , metrics [ 'tn' ] ) logging . info ( "F1: {}" . format ( f1_score ) ) if save : fobj . write ( "F1: {}\n" . format ( f1_score ) )