I am working on a project where I have 20+ classes/groups. Each of these groups perform certain text searches. I am looking for specific keywords example 'code' which is an anomaly. The challenge is that the term 'code' is very common in a few groups and not so common in other groups. I tried using K-means model so as to do grouping per class. While the groups are being generated well, I was hoping that the anomalous group would be the one with the least number of points and this would have the keyword 'code'. But I don't have success yet. Any suggestions would be appreciated.
Data format:
class | search_text |
---|---|
A | discuss |
A | code |
B | time |
A | code |
A | code |
B | code |
A | code |
Z | code |
Assuming there are 50k+ records and Z has only 1 occurrence of code. That should be the output.