code: def assess_model(
      y_pred,
      y_true,
      labels,
      target_names,
      labels_with_o,
      target_names_with_o,
      dataset_type,
      stats_graph_folder,
      epoch_number,
      parameters,
      evaluation_mode="bio",
      verbose=False,
  ):
      results = {}
      assert len(y_true) == len(y_pred)
  
      # Classification report
      classification_report = sklearn.metrics.classification_report(
          y_true,
          y_pred,
          labels=labels,
          target_names=target_names,
          sample_weight=None,
          digits=4,
      )
  
      utils_plots.plot_classification_report(
          classification_report,
          title="Classification report for epoch {0} in {1} ({2} evaluation)\n".format(
              epoch_number, dataset_type, evaluation_mode
          ),
          cmap="RdBu",
      )
      plt.savefig(
          os.path.join(
              stats_graph_folder,
              "classification_report_for_epoch_{0:04d}_in_{1}_{2}_evaluation.{3}".format(
                  epoch_number,
                  dataset_type,
                  evaluation_mode,
                  parameters["plot_format"],
              ),
          ),
          dpi=300,
          format=parameters["plot_format"],
          bbox_inches="tight",
      )
      plt.close()
      results["classification_report"] = classification_report
  
      # F1 scores
      results["f1_score"] = {}
      for f1_average_style in ["weighted", "micro", "macro"]:
          results["f1_score"][f1_average_style] = (
              sklearn.metrics.f1_score(
                  y_true,
                  y_pred,
                  average=f1_average_style,
                  labels=labels,
              )
              * 100
          )
      results["f1_score"]["per_label"] = [
          x * 100
          for x in sklearn.metrics.precision_recall_fscore_support(
              y_true, y_pred, average=None, labels=labels
          )[2].tolist()
      ]
  
      confusion_matrix = sklearn.metrics.confusion_matrix(
          y_true, y_pred, labels=labels_with_o
      )
      results["confusion_matrix"] = confusion_matrix.tolist()
      title = "Confusion matrix for epoch {0} in {1} ({2} evaluation)\n".format(
          epoch_number, dataset_type, evaluation_mode
      )
      xlabel = "Predicted"
      ylabel = "True"
      xticklabels = yticklabels = target_names_with_o
      utils_plots.heatmap(
          confusion_matrix,
          title,
          xlabel,
          ylabel,
          xticklabels,
          yticklabels,
          figure_width=40,
          figure_height=20,
          correct_orientation=True,
          fmt="%d",
          remove_diagonal=True,
      )
      plt.savefig(
          os.path.join(
              stats_graph_folder,
              "confusion_matrix_for_epoch_{0:04d}_in_{1}_{2}_evaluation.{3}".format(
                  epoch_number,
                  dataset_type,
                  evaluation_mode,
                  parameters["plot_format"],
              ),
          ),
          dpi=300,
          format=parameters["plot_format"],
          bbox_inches="tight",
      )
      plt.close()
  
      # Accuracy
      results["accuracy_score"] = (
          sklearn.metrics.accuracy_score(y_true, y_pred) * 100
      )
  
      return results
  
file_path: NeuroNER/neuroner/evaluate.py
imports: import json
  import os
  import pkg_resources
  import time
  import numpy
  import matplotlib.pyplot
  import sklearn.metrics
  from neuroner import utils_plots
  from neuroner import utils_nlp
label_desc: Use image node_id 1 for calling a global function with example usage: assess_model(y_pred, y_true, labels, target_names, labels_with_o, target_names_with_o, dataset_type, stats_graph_folder, epoch_number, parameters, evaluation_mode, verbose) and returns: results