(state_a, state_b)
return 1.0 / (1 + normal_distance)
The (L2) distance between the counts of the state addresses in the history of the path.
        :param state_a: The first state to compare
        :param state_b: The second state to compare
The (L2) distance between the counts of the state addresses in the history of the path.
        :param state_a: The first state to compare
        :param state_b: The second state to compare
The ( L2 ) distance between the counts of the state addresses in the history of the path . : param state_a : The first state to compare : param state_b : The second state to compare
def similarity(state_a, state_b):
        """
        The (L2) distance between the counts of the state addresses in the history of the path.
        :param state_a: The first state to compare
        :param state_b: The second state to compare
        """
        count_a = Counter(state_a.history.bbl_addrs)
        count_b = Counter(state_b.history.bbl_addrs)
        normal_distance = sum((count_a.get(addr, 0) - count_b.get(addr, 0)) ** 2
                              for addr in set(list(count_a.keys()) + list(count_b.keys()))) ** 0.5
        return 1.0 / (1 + normal_distance)
def similarity ( state_a , state_b ) : count_a = Counter ( state_a . history . bbl_addrs ) count_b = Counter ( state_b . history . bbl_addrs ) normal_distance = sum ( ( count_a . get ( addr , 0 ) - count_b . get ( addr , 0 ) ) ** 2 for addr in set ( list ( count_a . keys ( ) ) + list ( count_b . keys ( ) ) ) ) ** 0.5 return 1.0 / ( 1 + normal_distance )