Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Mahalanobis Distance in Practice | Section
Outlier and Novelty Detection
Секція 1. Розділ 8
single

single

bookChallenge: Mahalanobis Distance in Practice

Свайпніть щоб показати меню

Завдання

Проведіть, щоб почати кодувати

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:

  1. Compute the mean vector of the dataset.
  2. Compute the covariance matrix and its inverse.
  3. For each observation, compute Mahalanobis distance using the formula:
D(x)=(xμ)TΣ1(xμ)D(x) = \sqrt{(x - \mu)^T \Sigma^{-1} (x - \mu)}
  1. Store all distances in an array distances.
  2. Classify points as outliers if distance > threshold (use threshold = 2.5).
  3. Print both arrays (distances and outliers) for verification.

Use NumPy only.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 8
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt