def tanimoto_coefficient ( a , b ) : return sum ( map ( lambda ( x , y ) : float ( x ) * float ( y ) , zip ( a , b ) ) ) / sum ( [ - sum ( map ( lambda ( x , y ) : float ( x ) * float ( y ) , zip ( a , b ) ) ) , sum ( map ( lambda x : float ( x ) ** 2 , a ) ) , sum ( map ( lambda x : float ( x ) ** 2 , b ) ) ] )
pearsons cooefficient between 2 matricess in python
Measured similarity between two points in a multi - dimensional space .
def tanimoto_coefficient(a, b):
    """Measured similarity between two points in a multi-dimensional space.

    Returns:
        1.0 if the two points completely overlap,
        0.0 if the two points are infinitely far apart.
    """
    return sum(map(lambda (x,y): float(x)*float(y), zip(a,b))) / sum([
          -sum(map(lambda (x,y): float(x)*float(y), zip(a,b))),
           sum(map(lambda x: float(x)**2, a)),
           sum(map(lambda x: float(x)**2, b))])