In unsupervised anomaly detection, does including the contamination percentage turn isolation forest into supervised instead of unsupervised when I fit the data after?
1 Answer
Isolation Forest is fundamentally an unsupervised algorithm. Its core mechanism doesn't rely on labelled data to identify anomalies. Instead, it works by isolating anomalies based on how easy or difficult it is to separate individual data points from the rest of the dataset.
contamination‘auto’ or float, default=’auto’
The amount of contamination of the data set, i.e. the proportion of outliers in the data set. Used when fitting to define the threshold on the scores of the samples.
If ‘auto’, the threshold is determined as in the original paper.
If float, the contamination should be in the range (0, 0.5].
The contamination parameter in Isolation Forest isn't about providing labels. It's more like giving the algorithm a hint about how many anomalies to expect. It's saying, "Hey, we think about X% of our data might be anomalous."
Does including the contamination percentage turn isolation forest into supervised?
Short answer: Nope, it doesn't turn Isolation Forest into a supervised method.
Here's why:
- You're not providing actual labels for the anomalies.
- The algorithm still decides on its own which data points are anomalous.
- It's more of a tuning parameter than a supervisory signal.
What does contamination actually do?
- It helps set the threshold for what's considered an anomaly.
- It affects the decision function, influencing how strict or lenient the algorithm is in flagging anomalies.
How is Unsupervised nature preserved?
- The algorithm still learns the structure of the data without knowing which points are actually anomalous.
- It's making its own decisions based on the isolation principle, not based on pre-labeled examples.
So, to sum it up: Including the contamination parameter doesn't turn Isolation Forest into a supervised method. It's still very much unsupervised. The contamination is more like a hyperparameter that helps tune the algorithm's sensitivity, rather than a way of supervising the learning process.