code: def establishment_FPR(reference_patterns, estimated_patterns,
                        similarity_metric="cardinality_score"):
      
      validate(reference_patterns, estimated_patterns)
      nP = len(reference_patterns)    # Number of elements in reference
      nQ = len(estimated_patterns)    # Number of elements in estimation
      S = np.zeros((nP, nQ))          # Establishment matrix
  
      # If no patterns were provided, metric is zero
      if _n_onset_midi(reference_patterns) == 0 or \
         _n_onset_midi(estimated_patterns) == 0:
          return 0., 0., 0.
  
      for iP, ref_pattern in enumerate(reference_patterns):
          for iQ, est_pattern in enumerate(estimated_patterns):
              s = _compute_score_matrix(ref_pattern, est_pattern,
                                        similarity_metric)
              S[iP, iQ] = np.max(s)
  
      # Compute scores
      precision = np.mean(np.max(S, axis=0))
      recall = np.mean(np.max(S, axis=1))
      f_measure = util.f_measure(precision, recall)
      return f_measure, precision, recall
docs: Establishment F1 Score, Precision and Recall.
  
      Examples
      --------
      >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt")
      >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt")
      >>> F, P, R = mir_eval.pattern.establishment_FPR(ref_patterns,
      ...                                              est_patterns)
  
  
      Parameters
      ----------
      reference_patterns : list
          The reference patterns in the format returned by
          :func:`mir_eval.io.load_patterns()`
  
      estimated_patterns : list
          The estimated patterns in the same format
  
      similarity_metric : str
          A string representing the metric to be used when computing the
          similarity matrix. Accepted values:
  
              - "cardinality_score": Count of the intersection
                between occurrences.
  
          (Default value = "cardinality_score")
  
  
      Returns
      -------
      f_measure : float
          The establishment F1 Score
      precision : float
          The establishment Precision
      recall : float
          The establishment Recall