ee.Clusterer.wekaKMeans
Cluster data using the k-means algorithm. Can use either the Euclidean distance (default) or the Manhattan distance. If the Manhattan distance is used, then centroids are computed as the component-wise median rather than mean. For more information see:
D. Arthur, S. Vassilvitskii: k-means++: the advantages of careful seeding. In: Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, 1027-1035, 2007.
Usage | Returns |
---|
ee.Clusterer.wekaKMeans(nClusters, init, canopies, maxCandidates, periodicPruning, minDensity, t1, t2, distanceFunction, maxIterations, preserveOrder, fast, seed) | Clusterer |
Argument | Type | Details |
---|
nClusters | Integer | Number of clusters. |
init | Integer, default: 0 | Initialization method to use. 0 = random, 1 = k-means++, 2 = canopy, 3 = farthest first. |
canopies | Boolean, default: false | Use canopies to reduce the number of distance calculations. |
maxCandidates | Integer, default: 100 | Maximum number of candidate canopies to retain in memory at any one time when using canopy clustering. T2 distance plus, data characteristics, will determine how many candidate canopies are formed before periodic and final pruning are performed, which might result in exceess memory consumption. This setting avoids large numbers of candidate canopies consuming memory. |
periodicPruning | Integer, default: 10000 | How often to prune low density canopies when using canopy clustering. |
minDensity | Integer, default: 2 | Minimum canopy density, when using canopy clustering, below which a canopy will be pruned during periodic pruning. |
t1 | Float, default: -1.5 | The T1 distance to use when using canopy clustering. A value < 0 is taken as a positive multiplier for T2. |
t2 | Float, default: -1 | The T2 distance to use when using canopy clustering. Values < 0 cause a heuristic based on attribute std. deviation to be used. |
distanceFunction | String, default: "Euclidean" | Distance function to use. Options are: Euclidean and Manhattan. |
maxIterations | Integer, default: null | Maximum number of iterations. |
preserveOrder | Boolean, default: false | Preserve order of instances. |
fast | Boolean, default: false | Enables faster distance calculations, using cut-off values. Disables the calculation/output of squared errors/distances. |
seed | Integer, default: 10 | The randomization seed. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-19 UTC.
[null,null,["Last updated 2024-09-19 UTC."],[[["Clusters data using the k-means algorithm with either Euclidean (default) or Manhattan distance."],["If Manhattan distance is selected, centroids are calculated using the component-wise median instead of the mean."],["Offers various initialization methods including random, k-means++, canopy, and farthest first."],["Allows customization of distance calculation, iteration limits, and performance optimization through parameters."]]],["The k-means algorithm clusters data using either Euclidean or Manhattan distance. Manhattan distance uses component-wise median for centroids, while Euclidean uses the mean. Initialization methods include random, k-means++, canopy, and farthest first. Canopies can be used to optimize distance calculations. Parameters control the number of clusters, pruning frequency, density thresholds, and distance settings. Additional options include limiting iterations, preserving data order, and using a fast distance calculation mode.\n"]]