Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Example code for Power Iteration Clustering
  • Loading branch information
shahidki31 committed Jun 7, 2018
commit 6b75b8c20d862dba3f7679833a081296d2a2f8a3
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,10 @@ package org.apache.spark.examples.ml

// $example on$
import org.apache.spark.ml.clustering.PowerIterationClustering
import org.apache.spark.sql.SparkSession
// $example off$

/**
* An example demonstrating power iteration clustering.
* Run with
* {{{
* bin/run-example ml.PowerIterationClusteringExample
* }}}
*/
import org.apache.spark.sql.SparkSession

object PowerIterationClusteringExample {

def main(args: Array[String]): Unit = {
val spark = SparkSession
.builder
Expand All @@ -48,7 +39,6 @@ object PowerIterationClusteringExample {
(4L, 0L, 0.1)
)).toDF("src", "dst", "weight")

// Trains a PIC model.
val model = new PowerIterationClustering().
setK(2).
setMaxIter(20).
Expand All @@ -58,7 +48,7 @@ object PowerIterationClusteringExample {
val prediction = model.assignClusters(dataset).select("id", "cluster")

// Shows the cluster assignment
prediction.show()
prediction.show(false)
// $example off$

spark.stop()
Expand Down