You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
I have developed a k-means algorithm which accepts a maximum of 5 clusters. You can specify distance measure to use, i.e. 'euclidean', 'cosine' etc. and the function will also produce a scatter plot of your clustered data.
Please note:
- This is my first attempt at creating a k-means algorithm (created for university module work)
- It is by no means the fastest k-means algorithm available
- Uses random initialisation for initial centroids
- k_means_(d,k,distance)
- I have only tested it with a few types of data and have had great success, hopefully you won't have any problems
- If you are unfamiliar with this algorithm, please note that it requires a minimum of 2 dimensions for it to work.
- Use only numerical data i.e. ratio, interval. This algorithm is not suitable for categorical or ordinal data types.
Cite As
dangrewal (2026). k_means_(d, k, distance) (https://uk.mathworks.com/matlabcentral/fileexchange/48476-k_means_-d-k-distance), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.1.0.0 (2.71 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
