Skip to content

Instantly share code, notes, and snippets.

View bryanl's full-sized avatar
🚩
Out in the streets

Bryan Liles bryanl

🚩
Out in the streets
View GitHub Profile
@timperrett
timperrett / KMeans.scala
Created October 22, 2010 10:45
K-Means Clustering
import scalala.Scalala._;
import scalala.tensor._;
import scalala.tensor.dense_;
object KMeans {
// Returns the centers of the k clusters, and the clusters themselves
def cluster(data: Seq[Vector], k: Int): Seq[Vector] = {
var means = data.take(k);
var converged = false;