Skip to content
Closed
Prev Previous commit
Next Next commit
Example code for Power Iteration Clustering
  • Loading branch information
shahidki31 committed Jun 7, 2018
commit 427e4c6225b3a93799294ac7cc9a3cc1ccf644d6
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public static void main(String[] args) {
.setK(2)
.setMaxIter(10);

Dataset<Row> result = pic.transform(df);
Dataset<Row> result = pic.transform(df).select("id", "prediction");

// printing results
System.out.println("Clustering results [id , cluster]");
for (Row row : result.select("id", "prediction").collectAsList()) {
for (Row row : result.collectAsList()) {
System.out.println("[" + row.get(0) + " , " + row.get(1) + "]");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ object KMeansExample {
val spark = SparkSession
.builder
.appName(s"${this.getClass.getSimpleName}")
.master("local[*]")
.getOrCreate()

// $example on$
Expand Down