Cukmeans.py
Implementation of the kmeans algorithm using pycuda
Install / Use
/learn @shackenberg/Cukmeans.pyREADME
cukmeans.py - Kmeans in PyCUDA
This is an implemenations of the [clustering algorithm k-means][2] in [PyCUDA][3]. As the interface was taken from [Scipy K-means][1], one can easily replace all usages.
Sample usage
from cukmeans import cukmeans
from numpy.random import randn
nclusters = 100
npoints = 10000
dimensions = 2
data = randn(npoints, dimensions)
gpu_book, gpu_dist = cukmeans(data, nclusters)
Demo and benchmark modus
If you run the script directly it starts into a demo modus benchmarking itself against the C based Scipy implementation of kmeans and a kmeans implementation using flann (if available).
Contents
cukmeans.pythe kmeans implementationflkmeans.pya flann based kmeans implemantation as additional benchmark
Requirements
- PyCUDA: http://mathema.tician.de/software/pycuda
- Flann (optional*): https://github.com/mariusmuja/flann
* Flann is only needed as an aditional kmeans implementation to benchmark to. [1]: https://github.com/scipy/scipy/blob/master/scipy/cluster/vq.py [2]: https://en.wikipedia.org/wiki/K-means_clustering [3]: http://mathema.tician.de/software/pycuda
Related Skills
node-connect
352.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate 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
352.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
