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.
Cet exercice fait partie du cours
Anomaly Detection in Python
Instructions
- Find the mean of
probability_scoresacross rows. - Create a boolean mask that returns True when the probability is over 0.75.
- Use the
is_outliermask to filter the outliers.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de 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))