Python Forum
K means clustering using heatmap - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: K means clustering using heatmap (/thread-4820.html)



K means clustering using heatmap - Rifscape - Sep-10-2017

Hey guys,
So in another post I asked how to get a heat map working. Well I was able to get the heat map to work. But I've ran into another problem regarding k means clustering.
I have a beginner dataset which is https://raw.githubusercontent.com/gsprint23/cpts215/master/progassignments/files/simple.csv
and a final dataset which is

https://raw.githubusercontent.com/gsprint23/cpts215/master/progassignments/files/cancer.csv

and I need to use k means clustering to group it. I know for k means clustering I need to pick centers, and then compute the euclidean distance between the center and each point and then group them. I was wondering how I would go about doing this and finding the distance since the data is not in a (x,y) coordinate format.

If my question doesn't make sense, visually I need to transform a heatmap that looks like

https://camo.githubusercontent.com/7476c1923053e004dc1341613eabe2c924335cfa/68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f67737072696e7432332f637074733231352f6d61737465722f70726f6761737369676e6d656e74732f666967757265732f63616e6365725f6373765f686561746d61702e706e67
into

https://camo.githubusercontent.com/6018dbb7d8a9f63474628547cfcac711863ed5ec/68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f67737072696e7432332f637074733231352f6d61737465722f70726f6761737369676e6d656e74732f666967757265732f63616e6365725f6373765f686561746d61705f636c757374657265642e706e67
by using 2 means clustering
My major problem is that I don't understand how to k means clustering works for heatmaps such how to calculate the distance and reassign the points, if someone could explain this it would be most helpful.

Any tips on how I can go about doing this?
Thanks for reading