Get startedGet started for free

Aggregating and thresholding the probabilities

There are many aggregation methods available when using ensembles. The most popular ones are the arithmetic mean and median.

You can use the mean almost always, while you can reserve the median for cases when you have at least three or more classifiers in your estimators.

Use the arithmetic averaging to filter the outliers from the apple dataset. probability_scores, and apple is available from the previous exercise. NumPy is also loaded.

This exercise is part of the course

Anomaly Detection in Python

View Course

Exercise instructions

  • Find the mean of probability_scores across rows.
  • Create a boolean mask that returns True when the probability is over 0.75.
  • Use the is_outlier mask to filter the outliers.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Find the mean across rows
mean_probs = ____

# Create a boolean mask that uses a 75% threshold
is_outlier = ____

# Use the mask to filter outliers from apple
outliers = ____

print(len(outliers))
Edit and Run Code