Hi, I am trying to implement the Mahalanobis distance formula in python.
- points, a list of arrays that contain Iris data points
- centroids, a list of calculated centroids
The Mahalanobis formula needs to use a positive diagonal matrix with the rank equal to n the dimension of data.
What exactly is your question?
To compute the Mahalanobis distance formula in python, you can follow this tutorial https://www.machinelearningplus.com/statistics/mahalanobis-distance/.
Thanks for the link, but I am looking to use a positive diagonal matrix where it provides better performance than using an inverse covariance matrix.