def jaccard_similarity(s1, s2):
    """
    Calculates the Jaccard similarity for two samples.

    .. note:

        sample1 and sample2 should be the same length, and
        the sum of each sample should be greater than 0.

    Args:

        sample1: list of frequencies for sample 1
        sample2: list of frequencies for sample 2

    Returns:

        float: Jaccard similarity (between 0 and 1)
    """
    num = 0
    denom = 0
    for xy in zip(s1, s2):
        num += min(xy)
        denom += max(xy)
    return 1.0 * num / denom
