НачатьНачать бесплатно

Using outlier probabilities

An alternative to isolating outliers with contamination is using outlier probabilities. The best thing about this method is that you can choose an arbitrary probability threshold, which means you can be as confident as you want in the predictions.

IForest and big_mart are already loaded.

Это упражнение является частью курса

Anomaly Detection in Python

Посмотреть курс

Инструкции к упражнению

  • Calculate probabilities for both inliers and outliers.
  • Extract the probabilities for outliers into outlier_probs.
  • Filter the outliers into outliers by using a 70% threshold on outlier_probs.

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

iforest = IForest(random_state=10).fit(big_mart)

# Calculate probabilities
probs = iforest.____

# Extract the probabilities for outliers
outlier_probs = ____[____]

# Filter for when the probability is higher than 70%
outliers = ____[____]

print(len(outliers))
Редактировать и запускать код