I'm trying to use k-means to detect anomalies in the Amount
column. I have the following part of my dataset:
8 2018-09-06 -2760.14
9 2018-10-04 -1149.73
10 2018-11-07 -1551.41
11 2018-12-06 -1208.17
12 2019-01-07 -244.02
13 2019-02-06 111.00
14 2019-03-06 139.24
15 2019-04-04 -27315.10
16 2019-05-07 -30326.58
17 2019-06-06 -1633.44
I used 2 as number of clusters and I get the following centroids:
[[ -237.045]
[-28820.84 ]]
In my case the anomalies are rows 15 and 16 but now they form their own cluster so the distance to their centroid will be insignificant and thus not an anomaly
My question is, how can I detect the anomalies if they form their own cluster?