code: def predict_label(weights, sample):
      """Given the 9-dimensional weight vector which defines a 3 class classifier,
      predict the class of the given 3-dimensional sample vector.   Therefore, the
      output of this function is either 0, 1, or 2 (i.e. one of the three possible
      labels)."""
  
      # Our 3-class classifier model can be thought of as containing 3 separate
      # linear classifiers.  So to predict the class of a sample vector we
      # evaluate each of these three classifiers and then whatever classifier has
      # the largest output "wins" and predicts the label of the sample.  This is
      # the popular one-vs-all multi-class classifier model.
      # Keeping this in mind, the code below simply pulls the three separate
      # weight vectors out of weights and then evaluates each against sample.  The
      # individual classifier scores are stored in scores and the highest scoring
      # index is returned as the label.
      w0 = weights[0:3]
      w1 = weights[3:6]
      w2 = weights[6:9]
      scores = [dot(w0, sample), dot(w1, sample), dot(w2, sample)]
      max_scoring_label = scores.index(max(scores))
      return max_scoring_label
  
file_path: dlib/python_examples/svm_struct.py
imports: import dlib
label_desc: Use image node_id 2 for calling a global function with example usage: predict_label(weights, sample) and returns: max_scoring_label