code: def evaluate_model_for_folders(
      input_test_folders,
      model_name,
      model_type,
      positive_class,
      plot=True,
  ):
      """
      evaluate_model_for_folders(input_test_folders, model_name, model_type)
      This function evaluates a model by computing the confusion matrix, the
      per class performance metrics and by generating a ROC and Precision / Recall
      diagrams (for a particular class of interest), for a given test dataset.
      The dataset needs to be organized in folders (one folder per audio class),
      exactly like in extract_features_and_train()
      :param input_test_folders:  list of folders (each folder represents a
      separate audio class)
      :param model_name:  path to the model to be tested
      :param model_type:  type of the model
      :param positive_class name of the positive class
      :param plot (True default) if to plot 2 diagrams on plotly
      :return: thr_prre, pre, rec  (thresholds, precision recall values)
      thr_roc, fpr, tpr (thresholds, false positive , true positive rates)
  
      Usage example:
      from pyAudioAnalysis import audioTrainTest as aT
      thr_prre, pre, rec, thr_roc, fpr, tpr =
      aT.evaluate_model_for_folders(["4_classes_small/speech",
                                     "4_classes_small/music"],
                                     "data/models/svm_rbf_4class",
                                     "svm_rbf", "speech")
      """
  
      class_names = []
      y_true_binary = []
      y_true = []
      y_pred = []
      probs_positive = []
      for i, d in enumerate(input_test_folders):
          if d[-1] == os.sep:
              class_names.append(d.split(os.sep)[-2])
          else:
              class_names.append(d.split(os.sep)[-1])
  
          types = ("*.wav", "*.aif", "*.aiff", "*.mp3", "*.au", "*.ogg")
          wav_file_list = []
          for files in types:
              wav_file_list.extend(glob.glob(os.path.join(d, files)))
          # get list of audio files for current folder and run classifier
          for w in wav_file_list:
              c, p, probs_names = file_classification(
                  w, model_name, model_type
              )
              y_pred.append(c)
              y_true.append(probs_names.index(class_names[i]))
              if i == probs_names.index(positive_class):
                  y_true_binary.append(1)
              else:
                  y_true_binary.append(0)
  
              prob_positive = p[probs_names.index(positive_class)]
              probs_positive.append(prob_positive)
      pre, rec, thr_prre = sklearn.metrics.precision_recall_curve(
          y_true_binary, probs_positive
      )
      fpr, tpr, thr_roc = sklearn.metrics.roc_curve(
          y_true_binary, probs_positive
      )
      cm = sklearn.metrics.confusion_matrix(y_true, y_pred)
      rec_c, pre_c, f1_c = compute_class_rec_pre_f1(cm)
      f1 = sklearn.metrics.f1_score(y_true, y_pred, average="macro")
      acc = sklearn.metrics.accuracy_score(y_true, y_pred)
      print(cm)
      print(rec_c, pre_c, f1_c, f1, acc)
      if plot:
          titles = [
              "Confusion matrix, acc = {0:.1f}%, "
              " F1 (macro): {1:.1f}%".format(100 * acc, 100 * f1),
              "Class-wise Performance measures",
              "Pre vs Rec for " + positive_class,
              "ROC for " + positive_class,
          ]
          figs = plotly.subplots.make_subplots(
              rows=2, cols=2, subplot_titles=titles
          )
  
          heatmap = go.Heatmap(
              z=np.flip(cm, axis=0),
              x=class_names,
              y=list(reversed(class_names)),
              colorscale=[[0, "#4422ff"], [1, "#ff4422"]],
              name="confusin matrix",
              showscale=False,
          )
          mark_prop1 = dict(
              color="rgba(80, 220, 150, 0.5)",
              line=dict(color="rgba(80, 220, 150, 1)", width=2),
          )
          mark_prop2 = dict(
              color="rgba(80, 150, 220, 0.5)",
              line=dict(color="rgba(80, 150, 220, 1)", width=2),
          )
          mark_prop3 = dict(
              color="rgba(250, 150, 150, 0.5)",
              line=dict(color="rgba(250, 150, 150, 1)", width=3),
          )
          b1 = go.Bar(
              x=class_names, y=rec_c, name="Recall", marker=mark_prop1
          )
          b2 = go.Bar(
              x=class_names,
              y=pre_c,
              name="Precision",
              marker=mark_prop2,
          )
          b3 = go.Bar(
              x=class_names, y=f1_c, name="F1", marker=mark_prop3
          )
  
          figs.append_trace(heatmap, 1, 1)
          figs.append_trace(b1, 1, 2)
          figs.append_trace(b2, 1, 2)
          figs.append_trace(b3, 1, 2)
          figs.append_trace(
              go.Scatter(
                  x=thr_prre, y=pre, name="Precision", marker=mark_prop1
              ),
              2,
              1,
          )
          figs.append_trace(
              go.Scatter(
                  x=thr_prre, y=rec, name="Recall", marker=mark_prop2
              ),
              2,
              1,
          )
          figs.append_trace(
              go.Scatter(x=fpr, y=tpr, showlegend=False), 2, 2
          )
          figs.update_xaxes(title_text="threshold", row=2, col=1)
          figs.update_xaxes(
              title_text="false positive rate", row=2, col=2
          )
          figs.update_yaxes(
              title_text="true positive rate", row=2, col=2
          )
  
          plotly.offline.plot(
              figs, filename="temp.html", auto_open=True
          )
  
      return cm, thr_prre, pre, rec, thr_roc, fpr, tpr
  
imports: from __future__ import print_function
  from imblearn.under_sampling import RandomUnderSampler
  from imblearn.over_sampling import SMOTE
  from sklearn.model_selection import GroupShuffleSplit
  from pyAudioAnalysis import audioBasicIO
  from pyAudioAnalysis import MidTermFeatures
  import sys
  import numpy
  import os
  import glob
  import pickle
  import csv
  import ntpath
  from scipy import linalg
  from scipy.spatial import distance
  import sklearn.svm
  import sklearn.decomposition
  import sklearn.ensemble
  import plotly
  import plotly.subplots
  import plotly.graph_objs
  import sklearn.metrics
  from sklearn.model_selection import train_test_split
  from sklearn.preprocessing import StandardScaler
label_desc: Use image node_id 22 for calling a global function with example usage: evaluate_model_for_folders(input_test_folders, model_name, model_type, positive_class, plot) and returns: cm,  thr_prre,  pre,  rec,  thr_roc,  fpr,  tpr