Seção 1. Capítulo 8
single
Challenge: Mahalanobis Distance in Practice
Deslize para mostrar o menu
Tarefa
Deslize para começar a programar
You are given a small 2D dataset. Your goal is to compute the Mahalanobis distance of each observation from the data center and use it to detect outliers.
Steps:
- Compute the mean vector of the dataset.
- Compute the covariance matrix and its inverse.
- For each observation, compute Mahalanobis distance using the formula:
- Store all distances in an array
distances. - Classify points as outliers if
distance > threshold(usethreshold = 2.5). - Print both arrays (
distancesandoutliers) for verification.
Use NumPy only.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 8
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo