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

bookChallenge: Isolation Forest Implementation

Tehtävä

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.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. 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: Isolation Forest Implementation

Pyyhkäise näyttääksesi valikon

Tehtävä

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.

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 3. Luku 4
single

single

some-alt