Skip to content

Instantly share code, notes, and snippets.

@niektemme
Created July 31, 2015 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niektemme/99f41db04f474fb527dd to your computer and use it in GitHub Desktop.
Save niektemme/99f41db04f474fb527dd to your computer and use it in GitHub Desktop.
Smart Thermostat AWS Spark - part Spark cluster kmeans
val RDDscore = valRowsOnOff.map(result => result._2).map(result => Vectors.dense(result._1,result._2))
RDDscore.cache()
//use mllib k-means clustering to create clusters (temperature groups)
val numClusters = 10
val numIterations = 200
val clusters = KMeans.train(RDDscore, numClusters, numIterations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment