@@ -52,18 +52,33 @@ class KMeans private (
52
52
*/
53
53
def this () = this (2 , 20 , 1 , KMeans .K_MEANS_PARALLEL , 5 , 1e-4 , Utils .random.nextLong())
54
54
55
+ /**
56
+ * Number of clusters to create (k).
57
+ */
58
+ def getK : Int = k
59
+
55
60
/** Set the number of clusters to create (k). Default: 2. */
56
61
def setK (k : Int ): this .type = {
57
62
this .k = k
58
63
this
59
64
}
60
65
66
+ /**
67
+ * Maximum number of iterations to run.
68
+ */
69
+ def getMaxIterations : Int = maxIterations
70
+
61
71
/** Set maximum number of iterations to run. Default: 20. */
62
72
def setMaxIterations (maxIterations : Int ): this .type = {
63
73
this .maxIterations = maxIterations
64
74
this
65
75
}
66
76
77
+ /**
78
+ * The initialization algorithm. This can be either "random" or "k-means||".
79
+ */
80
+ def getInitializationMode : String = initializationMode
81
+
67
82
/**
68
83
* Set the initialization algorithm. This can be either "random" to choose random points as
69
84
* initial cluster centers, or "k-means||" to use a parallel variant of k-means++
@@ -77,6 +92,13 @@ class KMeans private (
77
92
this
78
93
}
79
94
95
+ /**
96
+ * :: Experimental ::
97
+ * Number of runs of the algorithm to execute in parallel.
98
+ */
99
+ @ Experimental
100
+ def getRuns : Int = runs
101
+
80
102
/**
81
103
* :: Experimental ::
82
104
* Set the number of runs of the algorithm to execute in parallel. We initialize the algorithm
@@ -92,6 +114,11 @@ class KMeans private (
92
114
this
93
115
}
94
116
117
+ /**
118
+ * Number of steps for the k-means|| initialization mode
119
+ */
120
+ def getInitializationSteps : Int = initializationSteps
121
+
95
122
/**
96
123
* Set the number of steps for the k-means|| initialization mode. This is an advanced
97
124
* setting -- the default of 5 is almost always enough. Default: 5.
@@ -104,6 +131,11 @@ class KMeans private (
104
131
this
105
132
}
106
133
134
+ /**
135
+ * The distance threshold within which we've consider centers to have converged.
136
+ */
137
+ def getEpsilon : Double = epsilon
138
+
107
139
/**
108
140
* Set the distance threshold within which we've consider centers to have converged.
109
141
* If all centers move less than this Euclidean distance, we stop iterating one run.
@@ -113,6 +145,11 @@ class KMeans private (
113
145
this
114
146
}
115
147
148
+ /**
149
+ * The random seed for cluster initialization.
150
+ */
151
+ def getSeed : Long = seed
152
+
116
153
/** Set the random seed for cluster initialization. */
117
154
def setSeed (seed : Long ): this .type = {
118
155
this .seed = seed
0 commit comments