An example of clustering using GMM with Spark MLlib

In the previous sections, we saw how to cluster the similar houses together to determine the neighborhood. Using GMM, it is also possible to cluster the houses toward finding the neighborhood except the model training that takes different training parameters as follows:

val K = 5 val maxIteration = 20 val model = new GaussianMixture()                .setK(K)// Number of desired clusters                .setMaxIterations(maxIteration)//Maximum iterations                .setConvergenceTol(0.05) // Convergence tolerance.                 .setSeed(12345) // setting seed to disallow randomness                .run(landRDD) // fit the model using the training set

You should refer to the previous example and just reuse the previous steps of getting the trained data. Now ...

Get Scala and Spark for Big Data Analytics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.