Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python mahalanobis distance

def mahalanobis(x=None, data=None, cov=None):

    x_mu = x - np.mean(data)
    if not cov:
        cov = np.cov(data.values.T)
    inv_covmat = np.linalg.inv(cov)
    left = np.dot(x_mu, inv_covmat)
    mahal = np.dot(left, x_mu.T)
    return mahal.diagonal()
Comment

PREVIOUS NEXT
Code Example
Python :: # convert dictionary into list of tuples 
Python :: python background function 
Python :: how to get a number from a string in python 
Python :: perimeter of circle 
Python :: change every value in a np array 
Python :: how to get username with userid discord.py 
Python :: pandas replace row values based on condition 
Python :: python do nothing 
Python :: curl python 
Python :: how to earse special chrat¥cter from string in python 
Python :: python nth prime function 
Python :: python how to create dict from dataframe based on 2 columns 
Python :: convert decimal to hex python 
Python :: set seed train test split 
Python :: multiple variables in for loop python 
Python :: django content type 
Python :: iso date convert in python 
Python :: tkinter prevent window resize 
Python :: discord.py fetch channel 
Python :: colorbar min max matplotlib 
Python :: python file open 
Python :: Simple Scatter Plot in matplotlib 
Python :: python create env ubuntu 
Python :: output path jupyter 
Python :: update queryset in django 
Python :: intersect in python list 
Python :: how to check if a input is an integer python 
Python :: get range of items of python list 
Python :: python try except 
Python :: python pynput space 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =