Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Mahalanobis Distance in Practice | Statistical and Distance-Based Methods
Outlier and Novelty Detection in Practice

bookChallenge: Mahalanobis Distance in Practice

Tehtävä

Swipe to start coding

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) = \sqrt{(x - \mu)^T \Sigma^{-1} (x - \mu)} ] 4. Store all distances in an array distances. 5. Classify points as outliers if distance > threshold (use threshold = 2.5). 6. Print both arrays (distances and outliers) for verification.

Use NumPy only.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 4
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

Awesome!

Completion rate improved to 4.55

bookChallenge: Mahalanobis Distance in Practice

Pyyhkäise näyttääksesi valikon

Tehtävä

Swipe to start coding

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) = \sqrt{(x - \mu)^T \Sigma^{-1} (x - \mu)} ] 4. Store all distances in an array distances. 5. Classify points as outliers if distance > threshold (use threshold = 2.5). 6. Print both arrays (distances and outliers) for verification.

Use NumPy only.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 4
single

single

some-alt