I am using an unsupervised isolation forest algorithm and computing anomaly scores to detect outliers from a 2 dimensional toy dataset. From a scatter plot, I am able to detect/visualize the data points with the highest anomaly scores (example: top 10 or top 15 outliers from the data)as my outliers. Is the number of outliers subjective to user decision (for example:Anomaly score of 0.5>S>1 is an outlier and everything less than 0.5 is not) or is there a way to detect the optimal number of outliers based on the anomaly scores?
The way Isolation Forests seem to be used in most of the cases involve having some kind of prior "guess" about what proportion of outliers you expect (if you want to be on the safe side, you might be encline to increase it for instance). Based on the proportion you set (it is the
contamination parameter in
scikit-learn), the observations are labeled according to their anomaly score.
That being said, nothing prevents you from coming up with your own rules after you ran the Isolation Forest. You can plot the anomaly scores and then see for yourself if another threshold could make sense based on the distribution of the scores. This would be a more empirical rule.