(lsh, minhash, total_num_events)
return float(len(neighbours)) / float(total_num_events)
Calculate a score based on Jaccard distance.

    The score is calculated based on how many similar events that there are
    for the event being scored. This is called neighbours and we simply
    calculate how many neighbours the event has divided by the total events
    in the LSH.

    Args:
        lsh: instance of datasketch.lsh.MinHashLSH
        minhash: instance of datasketch.minhash.MinHash
        total_num_events: integer of how many events in the LSH

    Returns:
        A float between 0 and 1.
Calculate a score based on Jaccard distance.
Calculate a score based on Jaccard distance .
def calculate_score(lsh, minhash, total_num_events):
    """Calculate a score based on Jaccard distance.

    The score is calculated based on how many similar events that there are
    for the event being scored. This is called neighbours and we simply
    calculate how many neighbours the event has divided by the total events
    in the LSH.

    Args:
        lsh: instance of datasketch.lsh.MinHashLSH
        minhash: instance of datasketch.minhash.MinHash
        total_num_events: integer of how many events in the LSH

    Returns:
        A float between 0 and 1.
    """
    neighbours = lsh.query(minhash)
    return float(len(neighbours)) / float(total_num_events)
def calculate_score ( lsh , minhash , total_num_events ) : neighbours = lsh . query ( minhash ) return float ( len ( neighbours ) ) / float ( total_num_events )