Session Ready
Exercise

LOF vs kNN

It is common to look first at the points with highest anomaly scores before taking any action. When several algorithms are used, the points with highest scores may differ.

In this final exercise, you'll calculate new LOF and kNN distance scores for the wine data, and print the highest scoring point for each.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Calculate the kNN distance score using the 10-nearest neighbors for each point.
  • Append the score as a new column called score_knn to the unstandardized wine dataframe.