Skip to content

Task: Isolation Forest model on Shuttle dataset - #26

Open
lalitgirgaonkar wants to merge 2 commits into
Tasksfrom
task-lalit
Open

Task: Isolation Forest model on Shuttle dataset#26
lalitgirgaonkar wants to merge 2 commits into
Tasksfrom
task-lalit

Conversation

@lalitgirgaonkar

Copy link
Copy Markdown
Collaborator

Pull Request

Related Issue

Closes #15


Task Summary

Provide a brief overview of your implementation.

  • Implemented Isolation Forest model on the Shuttle dataset from OpenML.
  • Loaded the dataset and analysed all the columns. Decided which classes to consider as normal values based on percentage of occurrence. Classes 1 and 4 made up roughly 94% of observations, so there were roughly 6% anomalies.
  • Scaled features using RobustScaler.
  • Evaluated model performance using precision, recall, F1 scores and ROC-AUC value.
  • Plotted Anomaly Distribution and Confusion Matrix

Dataset

  • Mammography
  • Shuttle

Dataset Source: OpenML


Preprocessing

Describe any preprocessing performed.

  • There were no missing values in the dataset.
  • Scaled the data using RobustScaler, to ensure that that extreme anomalies do not affect the values of normal points.
  • Mapped classes {1,4} to 1 (normal) and {2,3,5,6,7} to -1 (anomaly)

Model Configuration

List the important hyperparameters used.

Hyperparameter Value
n_estimators 100
contamination 0.0605
max_samples 256
max_features 1 (default)
random_state 42

Evaluation Results

Metric Value
Precision 0.93559
Recall 0.93506
F1-score 0.93532
ROC-AUC (Optional) 0.995

Visualizations

Attach at least 2 plots from your analysis.

Anomaly Distribution
Anomaly Distribution

Confusion Matrix
Confusion Matrix


Key Observations

  • The approximation that Class 1 and 4 are normal values had a positive impact, as the values of Precision and Recall were >90%.
  • I tried the model with and without scaling. There was not much difference between the two methods.
  • Contamination value had an impact on the output. Too small a value of contamination limited the number of anomalies flagged by the model which increased the number of false negatives.
  • Using the exact value of contamination gave the same value of Precision and Recall (around 0.93)

Checklist

  • Code runs successfully
  • Notebook (.ipynb) included
  • Code is well-commented
  • README/documentation updated
  • At least 2 plots included
  • PR is linked to the corresponding issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant