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

bookChallenge: LOF in Practice

Tâche

Swipe to start coding

You are given a 2D dataset with clusters and some outliers. Your task is to apply Local Outlier Factor (LOF) from sklearn.neighbors to identify which samples are locally inconsistent (low-density points).

Steps:

  1. Import and initialize LocalOutlierFactor with n_neighbors=20, contamination=0.1.
  2. Fit the model on X and obtain predictions via .fit_predict(X).
  3. Extract negative outlier factor values (model.negative_outlier_factor_).
  4. Print the number of detected outliers and example scores.

Remember:

  • -1 = outlier;
  • 1 = inlier.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 4
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Suggested prompts:

Can you explain that in simpler terms?

What are the main benefits of this approach?

Are there any common mistakes to avoid with this?

close

Awesome!

Completion rate improved to 4.55

bookChallenge: LOF in Practice

Glissez pour afficher le menu

Tâche

Swipe to start coding

You are given a 2D dataset with clusters and some outliers. Your task is to apply Local Outlier Factor (LOF) from sklearn.neighbors to identify which samples are locally inconsistent (low-density points).

Steps:

  1. Import and initialize LocalOutlierFactor with n_neighbors=20, contamination=0.1.
  2. Fit the model on X and obtain predictions via .fit_predict(X).
  3. Extract negative outlier factor values (model.negative_outlier_factor_).
  4. Print the number of detected outliers and example scores.

Remember:

  • -1 = outlier;
  • 1 = inlier.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 4
single

single

some-alt