File size: 188 Bytes
be9fb11
 
 
 
 
 
 
1
2
3
4
5
6
7
import numpy as np

def similarity(v1:np.ndarray, v2:np.ndarray):
    num = (v1 @ v2.T).item()
    denom = np.linalg.norm(v1) * np.linalg.norm(v2)
    print(num/denom)
    return num/denom