Session Ready
Exercise

A simple outlier

When you first encounter a new type of algorithm, it is always a great idea to test it with a very simple example. So you decide to create a list containing thirty examples with the value 1.0 and just one example with value 10.0, which you expect should be flagged as an outlier. To make sure you use the algorithm correctly, you convert the list to a pandas dataframe, and feed it into the local outlier factor algorithm. pandas is available to you as pd.

Instructions
100 XP
  • Import the LocalOutlierFactor module as lof for convenience.
  • Create a list with thirty 1s followed by a 10, [1.0, 1.0, ..., 1.0, 10.0].
  • Cast the list to a data frame.
  • Print the outlier scores produced by the local outlier factor algorithm.