@@ -52,18 +52,33 @@ class KMeans private (
5252 */
5353 def this () = this (2 , 20 , 1 , KMeans .K_MEANS_PARALLEL , 5 , 1e-4 , Utils .random.nextLong())
5454
55+ /**
56+ * Number of clusters to create (k).
57+ */
58+ def getK : Int = k
59+
5560 /** Set the number of clusters to create (k). Default: 2. */
5661 def setK (k : Int ): this .type = {
5762 this .k = k
5863 this
5964 }
6065
66+ /**
67+ * Maximum number of iterations to run.
68+ */
69+ def getMaxIterations : Int = maxIterations
70+
6171 /** Set maximum number of iterations to run. Default: 20. */
6272 def setMaxIterations (maxIterations : Int ): this .type = {
6373 this .maxIterations = maxIterations
6474 this
6575 }
6676
77+ /**
78+ * The initialization algorithm. This can be either "random" or "k-means||".
79+ */
80+ def getInitializationMode : String = initializationMode
81+
6782 /**
6883 * Set the initialization algorithm. This can be either "random" to choose random points as
6984 * initial cluster centers, or "k-means||" to use a parallel variant of k-means++
@@ -77,6 +92,11 @@ class KMeans private (
7792 this
7893 }
7994
95+ /**
96+ * Number of runs of the algorithm to execute in parallel.
97+ */
98+ def getRuns : Int = runs
99+
80100 /**
81101 * :: Experimental ::
82102 * Set the number of runs of the algorithm to execute in parallel. We initialize the algorithm
@@ -92,6 +112,11 @@ class KMeans private (
92112 this
93113 }
94114
115+ /**
116+ * Number of steps for the k-means|| initialization mode
117+ */
118+ def getInitializationSteps : Int = initializationSteps
119+
95120 /**
96121 * Set the number of steps for the k-means|| initialization mode. This is an advanced
97122 * setting -- the default of 5 is almost always enough. Default: 5.
@@ -104,6 +129,11 @@ class KMeans private (
104129 this
105130 }
106131
132+ /**
133+ * The distance threshold within which we've consider centers to have converged.
134+ */
135+ def getEpsilon : Double = epsilon
136+
107137 /**
108138 * Set the distance threshold within which we've consider centers to have converged.
109139 * If all centers move less than this Euclidean distance, we stop iterating one run.
@@ -113,6 +143,11 @@ class KMeans private (
113143 this
114144 }
115145
146+ /**
147+ * The random seed for cluster initialization.
148+ */
149+ def getSeed : Long = seed
150+
116151 /** Set the random seed for cluster initialization. */
117152 def setSeed (seed : Long ): this .type = {
118153 this .seed = seed
0 commit comments