Which scikit-learn algorithm is commonly used for unsupervised anomaly detection (finding unusual data points without labeled examples)?
Select an answer to reveal the explanation.
Short Explanation and Infographic
IsolationForest detects anomalies by asking 'how easy is it to isolate this point?' — outliers are isolated in just a few random splits, while normal points require many splits to be isolated.
Full explanation below image
Full Explanation
sklearn.ensemble.IsolationForest works by: 1) Randomly selecting a feature and a random split value. 2) Recursively partitioning the data. 3) Counting how many partitions it takes to isolate each point. Anomalies (unusual points) are isolated in very few partitions because they're in sparse regions. Normal points require many partitions because they're in dense regions. The anomaly score = negative average path length across all trees. IsolationForest.fit(X) learns the 'normal' distribution. IsolationForest.predict(X) returns 1 (normal) or -1 (anomaly). contamination parameter sets expected fraction of anomalies. On Databricks: run as a Pandas UDF or single-node on collected sample. IsolationForest is unsupervised — no labels needed. RandomForestClassifier, GBT, and LogisticRegression are supervised and require labeled training data.