I want to implement the covariance of training samples, which can be used when calculating the Mahalanobis distance. How can I implement this equation in Python?
I referenced that image in 'A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attacks'.