1. Learn
  2. /
  3. Courses
  4. /
  5. Anomaly Detection in Python

Connected

Exercise

KNN with outlier probabilities

Since we cannot wholly trust the output when using contamination, let's double-check our work using outlier probabilities. They are more trustworthy.

The dataset has been loaded as females and KNN estimator is also imported.

Instructions

100 XP
  • Instantiate KNN with 20 neighbors.
  • Calculate outlier probabilities.
  • Create a boolean mask that returns true values where the outlier probability is over 55%.
  • Use is_outlier to filter the outliers from females.