I am using Mahalanobis distance to identify outliers. I am training using kind of one class classification,by training only on positive samples and trying to predict negative samples using distance metric. I am using a threshold to seperate both the distances. Anything which is away from the ellipsoid is classified as negative. But I am confused about setting threshold value. enter image description here

As you can see, I manually set the threshold to 120 to seperate. I also used Chi square test, but the significance value should be very low to get the required. I use this method for multiple datasets. Is there any method other than manually?


1 Answer 1


In outlier estimation you will always need a parameter that say how robust you want to be and in most cases there is no simple rule that say what parameter to choose because maybe for one application we want to detect only a few very bad outliers, or in other applications we want to recover only data that are very close to the median. As you said, multiple testing could be another way but it will not work most of the time because you have a lot of tests and the power will be really bad (in theory) remark that in practice it could work nonetheless depending on the dimensions of your problem.

A common parameter is the proportion of outliers, for example you could say that in your application you believe there are no more than $1\%$ outliers, you compute your distance and then take out the points whose distance is in the $1\%$ higher quantile.

If you really want to have some automatic rule, there are some methods that present such rules and you could maybe use a modified version of those, for example see the parameter contamination in https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.IsolationForest.html , you could also search for a change point in the sequence of the sorted distances (i.e. is there are very different behavior between outliers and inliers) but this would not work if outliers were all over the place, it is done by hand here :https://www.machinelearningplus.com/statistics/mahalanobis-distance/ but you can automatically do this with changepoint detection algorithms. Using changepoint method, the "robustness parameter" will be in the parameters of the changepoint algorithm : how different points have to be to be considered outliers ?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.