Sklearn Isolation Forest icon

Sklearn Isolation Forest

Isolation Forest for anomaly detection using scikit-learn

Actions2

Train

AI-generated

Summary

Trains an Isolation Forest model on the given feature columns and returns anomaly predictions for each input row, attaching model metadata to the first record.

Inputs

  • featureColumns (required) — Comma-separated list of feature column names
  • nEstimators — Number of base estimators (trees)
  • contamination — Expected proportion of outliers (0.0 to 0.5)
  • randomState — Random seed for reproducibility
  • pythonPath — Path to Python executable with scikit-learn installed

Output shape

a list of records extending each input row with is_anomaly (boolean) and anomaly_score (float); the first record also includes model details (model_pickle, n_outliers, n_inliers)

The output list contains one entry per input row; predictions and anomaly scores are arrays; model metadata appears only on the first item and may be empty if training fails.

Examples

Example 1: Train on columns feature1,feature2,feature3 using default hyperparameters

featureColumns=feature1,feature2,feature3; nEstimators=100; contamination=0.1; randomState=42; pythonPath=python3

Example 2: Train with custom hyperparameters

featureColumns=colA,colB; nEstimators=250; contamination=0.05; randomState=123; pythonPath=python3

Discussion