Not all metrics agree
In the previous exercise you saw that not all metrics agree when it comes to identifying nearest neighbors. But does this mean they might disagree on outliers, too? You decide to put this to the test. You use the same data as before, but this time feed it into a local outlier factor outlier detector. The module LocalOutlierFactor has been made available to you as lof, and the data is available as features.
Latihan ini adalah bagian dari kursus
Designing Machine Learning Workflows in Python
Petunjuk latihan
- Detect outliers in
featuresusing theeuclideanmetric. - Detect outliers in
featuresusing thehammingmetric. - Detect outliers in
featuresusing thejaccardmetric. - Find if all three metrics agree on any one outlier.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Compute outliers according to the euclidean metric
out_eucl = ____(metric='euclidean').fit_predict(features)
# Compute outliers according to the hamming metric
out_hamm = ____(metric=____).fit_predict(features)
# Compute outliers according to the jaccard metric
out_jacc = ____(____=____).____(features)
# Find if the metrics agree on any one datapoint
print(any(____ + ____ + ____ == ____))