code: def _compute_accuracy(ytrue, ypred, labels=None, weights=None):
      if labels is not None:
          labels = set(labels)
          found = np.array(
              [
                  yt in labels or yp in labels
                  for yt, yp in zip(ytrue, ypred)
              ],
              dtype=bool,
          )
          ytrue = ytrue[found]
          ypred = ypred[found]
          if weights is not None:
              weights = weights[found]
  
      if ytrue.size > 0:
          scores = ytrue == ypred
          if weights is not None:
              try:
                  accuracy = np.sum(weights * scores) / np.sum(weights)
              except ZeroDivisionError:
                  accuracy = 0.0
          else:
              accuracy = np.mean(scores)
      else:
          accuracy = 0.0
  
      return accuracy
  
file_path: fiftyone/fiftyone/utils/eval/base.py
imports: import itertools
  import numpy
  import sklearn.metrics
  import fiftyone.core.evaluation
  import fiftyone.core.plots
label_desc: Use image node_id 2 for calling a global function with example usage: _compute_accuracy(ytrue, ypred, labels, weights) and returns: accuracy