I have the need to do a confusion matrix for data run through k-means with two features. I am aware that this is a clustering algorithm and not a classification algorithm but I have seen some articles and questions where it has been done. I am just to thick to decompose the answers and apply it to my situation.
I have data which looks like this:
Total Packets | Total TCP |
---|---|
2 | 0 |
0 | 0 |
0 | 0 |
4 | 0 |
1 | 1 |
4 | 2 |
0 | 0 |
0 | 0 |
0 | 0 |
1 | 1 |
0 | 0 |
93 | 85 |
1234 | 1232 |
699 | 695 |
4 | 4 |
2 | 2 |
0 | 0 |
0 | 0 |
0 | 0 |
0 | 0 |
0 | 0 |
4 | 0 |
0 | 0 |
4 | 0 |
6 | 4 |
3 | 3 |
0 | 0 |
0 | 0 |
0 | 0 |
Thats the top of the data file with the anomalies/outliers being anything over 200 in the Total TCP column. Where the confusion starts is understanding what is meant in the answer in this link k-means question where the responder mentions k-means labels and truth labels in his answer about how to do a confusion matrix. I have provided a quote for context:
"Assuming that you have some gold standard for the classification of your headlines into k groups (the truth), you could compare this to the KMeans clustering (the prediction).
The only problem with this is that KMeans clustering is agnostic to your truth, meaning the cluster labels that it produces will not be matched to the labels of the gold standard groups. There is, however, a work-around for this, which is to match the kmeans labels to the truth labels based on the best possible match."
Has anyone an idea of what the labels would be with my example? I have followed a tutorial in another link Outlier Detection with K-means and with a K of one it seemed to pick up the outliers as seen in this plot:
The red circles are around the outliers. In terms of where I am I have the program to a point where I can get the outliers but I would like to do a confusion matrix on top of this. I think that has to to with the K-means labels and truth labels mentioned previously but I am a bit lost in how to proceed. Any help would be greatly appreciated and I hope there is enough information in the post.