Distance and clustering.

In k-means clustering code which uses Euclidean distance. I want to replace Euclidean distance by Mahalanobis distance.

Respuestas (1)

Image Analyst
Image Analyst el 13 de Ag. de 2016

0 votos

Can you program in the formula from here: https://en.wikipedia.org/wiki/Mahalanobis_distance
Or just use the mahal() function if you have the Statistics and Machine Learning Toolbox:
Description d = mahal(Y,X) computes the Mahalanobis distance (in squared units) of each observation in Y from the reference sample in matrix X. If Y is n-by-m, where n is the number of observations and m is the dimension of the data, d is n-by-1. X and Y must have the same number of columns, but can have different numbers of rows. X must have more rows than columns.

1 comentario

John D'Errico
John D'Errico el 13 de Ag. de 2016
hello_world has been asking the same question repeatedly. This is the 4th question I've seen from them on the exact same topic.

Iniciar sesión para comentar.

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 13 de Ag. de 2016

Comentada:

el 13 de Ag. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by