code: def confidence(preds):
      conf = 0
      for pred in preds:
          conf += pred[0][0].confidence
      return conf / len(preds) if len(preds) else 0
  
imports: import logging
  import numpy
  import torch
  from functools import reduce
  from scipy.stats import pearsonr, spearmanr
  from seqeval.metrics import classification_report
  from seqeval.metrics import f1_score
  from sklearn.metrics import matthews_corrcoef, f1_score, mean_squared_error, r2_score, classification_report
  from farm.utils import flatten_list
label_desc: Use image node_id 13 for calling a global function with example usage: confidence(preds) and returns: unknown