Question: For this assignment, you are implementing the k -Meansclustering algorithm in python. The command to run the algorithmshould be as follows: ./yourprog values.txt k where

For this assignment, you are implementing the k-Meansclustering algorithm in python. The command to run the algorithmshould be as follows:

./yourprog values.txt k

where values.txt is a space-separated file which contains a setof 2D objects with numeric attributes and k is the numberof clusters you wish to find.

For example:


values.txt


12 32
43 25
178 234
32 49
156 200

values-output.txt

12 32 0
43 25 0
178 234 1
32 49 0
156 200 1

The output should be a space separated text file with the thirdcolumn having the discovered cluster index for each data object.There should be no output to console.

Please do not import a library which already hask-Means implemented. This has happened in thepast by students using scikit.learn and finding thek-Means implementation in there. The objective of thisassignment is to get practice on the machinery of k-Meansand have some programming practice in the process; not to analyzedata.

Edit : code should be in python for k-meanclustering algorithm. Cant use libraries like scikit.learn

Step by Step Solution

3.36 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!