code: def thirds(reference_labels, estimated_labels):
      
      validate(reference_labels, estimated_labels)
      ref_roots, ref_semitones = encode_many(reference_labels, False)[:2]
      est_roots, est_semitones = encode_many(estimated_labels, False)[:2]
  
      eq_roots = ref_roots == est_roots
      eq_thirds = ref_semitones[:, 3] == est_semitones[:, 3]
      comparison_scores = (eq_roots * eq_thirds).astype(np.float)
  
      # Ignore 'X' chords
      comparison_scores[np.any(ref_semitones < 0, axis=1)] = -1.0
      return comparison_scores
docs: Compare chords along root & third relationships.
  
      Examples
      --------
      >>> (ref_intervals,
      ...  ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab')
      >>> (est_intervals,
      ...  est_labels) = mir_eval.io.load_labeled_intervals('est.lab')
      >>> est_intervals, est_labels = mir_eval.util.adjust_intervals(
      ...     est_intervals, est_labels, ref_intervals.min(),
      ...     ref_intervals.max(), mir_eval.chord.NO_CHORD,
      ...     mir_eval.chord.NO_CHORD)
      >>> (intervals,
      ...  ref_labels,
      ...  est_labels) = mir_eval.util.merge_labeled_intervals(
      ...      ref_intervals, ref_labels, est_intervals, est_labels)
      >>> durations = mir_eval.util.intervals_to_durations(intervals)
      >>> comparisons = mir_eval.chord.thirds(ref_labels, est_labels)
      >>> score = mir_eval.chord.weighted_accuracy(comparisons, durations)
  
      Parameters
      ----------
      reference_labels : list, len=n
          Reference chord labels to score against.
      estimated_labels : list, len=n
          Estimated chord labels to score against.
  
      Returns
      -------
      comparison_scores : np.ndarray, shape=(n,), dtype=float
          Comparison scores, in [0.0, 1.0]