Skip to content

Commit 2b18ea9

Browse files
colorantrxin
authored andcommitted
Clean up SparkKMeans example's code
remove unused code Author: Raymond Liu <[email protected]> Closes apache#1352 from colorant/kmeans and squashes the following commits: ddcd1dd [Raymond Liu] Clean up SparkKMeans example's code
1 parent 553c578 commit 2b18ea9

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

examples/src/main/scala/org/apache/spark/examples/SparkKMeans.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.spark.examples
1919

20-
import java.util.Random
21-
2220
import breeze.linalg.{Vector, DenseVector, squaredDistance}
2321

2422
import org.apache.spark.{SparkConf, SparkContext}
@@ -28,15 +26,12 @@ import org.apache.spark.SparkContext._
2826
* K-means clustering.
2927
*/
3028
object SparkKMeans {
31-
val R = 1000 // Scaling factor
32-
val rand = new Random(42)
3329

3430
def parseVector(line: String): Vector[Double] = {
3531
DenseVector(line.split(' ').map(_.toDouble))
3632
}
3733

3834
def closestPoint(p: Vector[Double], centers: Array[Vector[Double]]): Int = {
39-
var index = 0
4035
var bestIndex = 0
4136
var closest = Double.PositiveInfinity
4237

0 commit comments

Comments
 (0)