def _compute_score_matrix(P, Q, similarity_metric="cardinality_score"):
    """Computes the score matrix between the patterns P and Q.

    Parameters
    ----------
    P : list
        Pattern containing a list of occurrences.
    Q : list
        Pattern containing a list of occurrences.
    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
    -------
    sm : np.array
        The score matrix between P and Q using the similarity_metric.

    """
    sm = np.zeros((len(P), len(Q)))     # The score matrix
    for iP, occ_P in enumerate(P):
        for iQ, occ_Q in enumerate(Q):
            if similarity_metric == "cardinality_score":
                denom = float(np.max([len(occ_P), len(occ_Q)]))
                # Compute the score
                sm[iP, iQ] = len(_occurrence_intersection(occ_P, occ_Q)) / \
                    denom
            # TODO: More scores: 'normalised matching socre'
            else:
                raise ValueError("The similarity metric (%s) can only be: "
                                 "'cardinality_score'.")
    return sm
Computes the score matrix between the patterns P and Q.

    Parameters
    ----------
    P : list
        Pattern containing a list of occurrences.
    Q : list
        Pattern containing a list of occurrences.
    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
    -------
    sm : np.array
        The score matrix between P and Q using the similarity_metric.