[Task] Implement Isolation Forest on the Shuttle Dataset#24
Open
ankitkumar25-rk wants to merge 2 commits into
Open
[Task] Implement Isolation Forest on the Shuttle Dataset#24ankitkumar25-rk wants to merge 2 commits into
ankitkumar25-rk wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Related Issue
Closes #18
Task Summary
I used Isolation Forest algorithm to find anomalies in the Shuttle dataset. This dataset had 7
classes in it, but I needed only 2 classes (normal and anomaly) for this task, so I changed it
myself. I made class 1 and 4 as normal, and the rest of the classes as anomaly because they had
very less count. After that I trained the Isolation Forest model (this model does not need labels
to train, which is a good thing) and checked how good it is doing by comparing with the real
labels. I also changed the contamination value a few times to see what happens to the results.
Dataset
Dataset Source: I got the dataset from OpenML in
.arfffile format.Preprocessing
isnull().sum()and there was no missing value anywherescipy.io.arffto open the file because normalread_csvwas not working on arff filesclasscolumn was coming likeb'1'(in bytes form), so I used.str.decode('utf-8')tofix it and then changed it to int
labelcolumn: class 1 and 4 = normal (0), class 2,3,5,6,7 = anomaly (1). Thisgives around 6.05% anomaly rate which looks realistic
used while training)
stays same in both parts
Model Configuration
Evaluation Results
Visualizations
Key Observations
that are easy to separate from others and calls them anomaly
model draws the line between normal and anomaly
(0.146), because model became too strict
(0.298), because model started calling too many points as anomaly
at default values (100 and 256)
how to split the 7 classes into 2 classes was confusing at first but looking at the class count
helped me decide
Checklist
.ipynb) included