code: def acc_and_f1(preds, labels):
      """return accuracy and f1 score"""
      acc = simple_accuracy(preds, labels)
      f1 = classification_f1_score(y_true=labels, y_pred=preds)
      return {
          "acc": acc,
          "f1": f1,
          "acc_and_f1": (acc + f1) / 2,
      }
  
file_path: nlp-architect/nlp_architect/utils/metrics.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from scipy.stats import pearsonr, spearmanr
  from sklearn.metrics import f1_score
  from collections import defaultdict
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: acc_and_f1(preds, labels) and returns: dict