KMeansPlusPlus
Python K-means++ implementation
Install / Use
/learn @JasonFuu/KMeansPlusPlusREADME
KMeansPlusPlus
Python K-means++ implementation
About
This implementation is more for my own purposes and to get a better idea of how K-Means++/K-Means work
Requirements
- Python 3.x
- Numpy
- Matplotlib (optional, to run Testing.py and graph results)
Usage
The constructor takes in two arguments, points_list and k:
-
points_list: 2d list containing n-dimensional pointspoints_list = [[Point1], [Point2], etc.]; n-dimensional point x = [X1, X2, ..., Xn]
-
k: Number of desired clusters/centroids
Calling final_centroids after creating the object returns the final centroids in the same format as points_list
Example
Seeds from randomly generated data, x∈[0, 100], y∈[0, 50], n = 50, k = 7:

Notes
Testing.py is used to create the screenshots, but is not necessary to run K-Means++
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
