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

bookChallenge: Isolation Forest Implementation

Compito

Swipe to start coding

You are given a 2D dataset containing normal points and a few outliers. Your goal is to train an Isolation Forest model to detect anomalies, compute anomaly scores, and flag potential outliers.

Steps:

  1. Import and initialize IsolationForest from sklearn.ensemble.
  2. Fit the model on the dataset X.
  3. Compute anomaly scores using decision_function(X).
  4. Predict labels using .predict(X) — note:
    • 1 → inlier
    • -1 → outlier
  5. Print the number of detected outliers and show example scores.
  6. Use parameters: contamination=0.15, random_state=42, and n_estimators=100.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 3. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

close

Awesome!

Completion rate improved to 4.55

bookChallenge: Isolation Forest Implementation

Scorri per mostrare il menu

Compito

Swipe to start coding

You are given a 2D dataset containing normal points and a few outliers. Your goal is to train an Isolation Forest model to detect anomalies, compute anomaly scores, and flag potential outliers.

Steps:

  1. Import and initialize IsolationForest from sklearn.ensemble.
  2. Fit the model on the dataset X.
  3. Compute anomaly scores using decision_function(X).
  4. Predict labels using .predict(X) — note:
    • 1 → inlier
    • -1 → outlier
  5. Print the number of detected outliers and show example scores.
  6. Use parameters: contamination=0.15, random_state=42, and n_estimators=100.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 3. Capitolo 4
single

single

some-alt