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

bookChallenge: Isolation Forest Implementation

Oppgave

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.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 4
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

Awesome!

Completion rate improved to 4.55

bookChallenge: Isolation Forest Implementation

Sveip for å vise menyen

Oppgave

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 4
single

single

some-alt