I am trying to debug the following code where I get the aforementioned error message: TypeError: unsupported operand type(s) for *: 'map' and 'map'
I did my fair search online and I understand that the square operation is not supported but I cannot fully understand how to resolve it.
My code is the following:
mahalanobis = lambda p: distance.mahalanobis(p, means, covariances.T)
d = np.array(map(mahalanobis, data)) # Mahalanobis distance values
d2 = d ** 2 # MD squared
The error pops up in the square calculation. All data types are numpy.ndarrays.
Convert map
into list
:
d = np.array(list(map(mahalanobis, data)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With