# Using an unsupervised Isolation Forest, how does one identify the optimal number of outliers from the anomaly scores?

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?

• Hello! Welcome to our community! Would you mind posting your plot, just to illustrate? Maybe we can identify a certain kind of distribution. For example in a Gaussian distribution we consider a sample to be outlier if it differs from the mean by $2\sigma$ – Pedro Henrique Monforte Apr 9 '19 at 19:01

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.