code: def _f1_score_eval_fn(
      predictions,
      targets=None,
      metrics=None,
      pos_label=1,
      average="binary",
      sample_weight=None,
  ):
      if targets is not None and len(targets) != 0:
          from sklearn.metrics import f1_score
  
          f1 = f1_score(
              targets,
              predictions,
              pos_label=pos_label,
              average=average,
              sample_weight=sample_weight,
          )
          return MetricValue(aggregate_results={"f1_score": f1})
  
imports: import functools
  import logging
  import os
  import numpy
  from mlflow.metrics.base import MetricValue, standard_aggregations
label_desc: Use image node_id 22 for calling a global function with example usage: _f1_score_eval_fn(predictions, targets, metrics, pos_label, average, sample_weight) and returns: MetricValue