def occurrence_FPR(reference_patterns, estimated_patterns, thres=.75,
                   similarity_metric="cardinality_score"):
    """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.occurrence_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
    thres : float
        How similar two occcurrences must be in order to be considered
        equal
        (Default value = .75)
    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

    """
    validate(reference_patterns, estimated_patterns)
    # Number of elements in reference
    nP = len(reference_patterns)
    # Number of elements in estimation
    nQ = len(estimated_patterns)
    # Occurrence matrix with Precision and recall in its last dimension
    O_PR = np.zeros((nP, nQ, 2))

    # Index of the values that are greater than the specified threshold
    rel_idx = np.empty((0, 2), dtype=int)

    # 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)
            if np.max(s) >= thres:
                O_PR[iP, iQ, 0] = np.mean(np.max(s, axis=0))
                O_PR[iP, iQ, 1] = np.mean(np.max(s, axis=1))
                rel_idx = np.vstack((rel_idx, [iP, iQ]))

    # Compute the scores
    if len(rel_idx) == 0:
        precision = 0
        recall = 0
    else:
        P = O_PR[:, :, 0]
        precision = np.mean(np.max(P[np.ix_(rel_idx[:, 0], rel_idx[:, 1])],
                                   axis=0))
        R = O_PR[:, :, 1]
        recall = np.mean(np.max(R[np.ix_(rel_idx[:, 0], rel_idx[:, 1])],
                                axis=1))
    f_measure = util.f_measure(precision, recall)
    return f_measure, precision, recall
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.occurrence_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
    thres : float
        How similar two occcurrences must be in order to be considered
        equal
        (Default value = .75)
    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