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.
Este exercício faz parte do curso
Anomaly Detection in Python
Instruções do exercício
- 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.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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))