Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 873 Bytes

File metadata and controls

15 lines (10 loc) · 873 Bytes

K-Means Clustering

Assignment for University of Liverpool COMP527

This repository includes a .py file containing a k-means clustering algorithm, a test for clustering accuracy (through precision, recall and F-score calculations) and plotting of line graphs for the accuracy scores.

The k-means clustering algorithm is implemented between lines 55-126. The clustering accuracy scores are calculated between lines 129-266. The plotting function is implemented between lines 285-300.

Running the code

In order to run the code, open the file within a compatible software (e.g. Spyder or PyCharm).

Ensure that the path (line 8) is altered to your local working directory which contains the data files 'animals', 'countries', 'fruits' and 'veggies'.

Click Run and all of the code for all questions will automatically run, as the code is set up between lines 303-352.