K-means on CUDA with CUV [edit]
Since I felt that our CUDA library, CUV, was a little lifeless without some examples on how it can be used, I started to work on a K-means implementation using it. The idea is to have something like from cuv_python import kmeans [clusters, assignements]=kmeans(data) run k-means on the GPU. There are some papers on kmeans on the GPU out there but I thought I see how far a little coding will get me. As an (maybe a little atypical) example, I choose MNIST as a dataset. My experiments were with k=10 or k=20 but this should not be a restriction on the implementation. First, I tried to do it without adding anything to CUV, just using simple matrix operations that were already there. The result is something like this: clusters=mnist[:,rand_indices] mnist_dev=cp.push(mnist) # copy('F') is necessary so we can slice later on clusters_dev=cp.push(clusters.copy("F")) norms = cp.dev_matrix_cmf(mnist_dev.w, 1) cp.reduce_to_row(norms.vec,mnist_dev,cp.reduce_functor.ADD_S