How to calculate the correlation distance between two arrays in Python

1 Answer

0 votes
from scipy.spatial.distance import correlation
import numpy as np

arr1 = np.array([1, 1, 1, 0, 0, 1, 0])
arr2 = np.array([0, 1, 0, 1, 1, 0, 1])

print(correlation(arr1, arr2))




'''
run:

1.75

'''

 



answered Mar 2, 2023 by avibootz
...