Detecting outliers with IForest
IForest is a robust estimator and only requires a few lines of code to detect outliers from any dataset. You may find that this syntax looks familiar since it closely resembles sklearn syntax.
The full version of the Big Mart Sales data has been loaded for you as big_mart, which you can explore in the console.
Это упражнение является частью курса
Anomaly Detection in Python
Инструкции к упражнению
- Import the
IForestestimator frompyod. - Initialize an
IForest()with default parameters. - Fit the estimator and generate predictions on the
big_martsimultaneously, and store the results inlabels. - Use
pandassubsetting to filter out the outliers frombig_mart.
Интерактивное практическое упражнение
Попробуйте выполнить это упражнение, дополнив этот пример кода.
# Import IForest from pyod
from pyod.____ import ____
# Initialize an instance with default parameters
iforest = ____
# Generate outlier labels
labels = ____
# Filter big_mart for outliers
outliers = ____
print(outliers.shape)