公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取。如未在 2025 年 9 月 26 日前完成驗證,存取權可能會暫停。
ee.Clusterer.wekaKMeans
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
使用 k-means 演算法叢集資料。可以使用歐幾里得距離 (預設) 或曼哈頓距離。如果使用曼哈頓距離,則會以元件中位數而非平均值計算質心。如需詳細資訊,請參閱:
D. Arthur, S. Vassilvitskii:k-means++:仔細播種的優點。In: Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, 1027-1035, 2007.
| 用量 | 傳回 |
|---|
ee.Clusterer.wekaKMeans(nClusters, init, canopies, maxCandidates, periodicPruning, minDensity, t1, t2, distanceFunction, maxIterations, preserveOrder, fast, seed) | 叢集器 |
| 引數 | 類型 | 詳細資料 |
|---|
nClusters | 整數 | 叢集數量。 |
init | 整數,預設值為 0 | 要使用的初始化方法。0 = 隨機、1 = k-means++、2 = canopy、3 = farthest first。 |
canopies | 布林值,預設值為 false | 使用樹冠可減少距離計算次數。 |
maxCandidates | 整數,預設值為 100 | 使用樹冠叢集時,記憶體中可保留的候選樹冠數量上限。T2 距離加上資料特徵,會決定在執行週期性和最終修剪作業前形成多少候選樹冠,這可能會導致記憶體用量過多。這項設定可避免大量候選樹冠耗用記憶體。 |
periodicPruning | 整數,預設值為 10000 | 使用樹冠叢集時,修剪低密度樹冠的頻率。 |
minDensity | 整數,預設值為 2 | 使用樹冠叢集時的最低樹冠密度,低於此值時,系統會在定期修剪期間修剪樹冠。 |
t1 | 浮點值,預設值為 -1.5 | 使用樹冠叢集時要使用的 T1 距離。如果值 < 0,系統會將其視為 T2 的正乘數。 |
t2 | 浮點值 (預設值為 -1) | 使用樹冠叢集時要使用的 T2 距離。如果值 < 0,系統會根據屬性標準差使用啟發式方法。 |
distanceFunction | 字串,預設值為「Euclidean」 | 要使用的距離函式。選項包括:歐幾里得和曼哈頓。 |
maxIterations | 整數,預設值為 null | 疊代次數上限。 |
preserveOrder | 布林值,預設值為 false | 保留執行個體順序。 |
fast | 布林值,預設值為 false | 使用截斷值,加快距離計算速度。停用平方誤差/距離的計算/輸出。 |
seed | 整數,預設值為 10 | 隨機化種子。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[],["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"]]