ee.Clusterer.wekaKMeans
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Nhóm dữ liệu bằng thuật toán k-means. Có thể sử dụng khoảng cách Euclidean (mặc định) hoặc khoảng cách Manhattan. Nếu khoảng cách Manhattan được sử dụng, thì các tâm sẽ được tính là trung vị theo thành phần chứ không phải giá trị trung bình. Để biết thêm thông tin, hãy xem:
D. Arthur, S. Vassilvitskii: k-means++: ưu điểm của việc gieo hạt cẩn thận. Trong: Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, 1027-1035, 2007.
Cách sử dụng | Giá trị trả về |
---|
ee.Clusterer.wekaKMeans(nClusters, init, canopies, maxCandidates, periodicPruning, minDensity, t1, t2, distanceFunction, maxIterations, preserveOrder, fast, seed) | Clusterer |
Đối số | Loại | Thông tin chi tiết |
---|
nClusters | Số nguyên | Số lượng cụm. |
init | Số nguyên, mặc định: 0 | Phương thức khởi tạo để sử dụng. 0 = ngẫu nhiên, 1 = k-means++, 2 = canopy, 3 = xa nhất trước. |
canopies | Boolean, mặc định: false | Sử dụng tán cây để giảm số lượng phép tính khoảng cách. |
maxCandidates | Số nguyên, mặc định: 100 | Số lượng tối đa các tán cây ứng cử viên cần giữ lại trong bộ nhớ tại một thời điểm bất kỳ khi sử dụng tính năng phân cụm tán cây. Khoảng cách T2 cộng với đặc điểm dữ liệu sẽ xác định số lượng tán cây đề xuất được hình thành trước khi thực hiện việc cắt tỉa định kỳ và cuối cùng, điều này có thể dẫn đến mức tiêu thụ bộ nhớ quá mức. Chế độ cài đặt này giúp tránh trường hợp có quá nhiều tán cây đề xuất tiêu tốn bộ nhớ. |
periodicPruning | Số nguyên, mặc định: 10000 | Tần suất tỉa tán lá có mật độ thấp khi sử dụng phương pháp phân cụm tán lá. |
minDensity | Số nguyên, mặc định: 2 | Mật độ tán cây tối thiểu, khi sử dụng tính năng phân cụm tán cây, dưới mức này, tán cây sẽ bị cắt tỉa trong quá trình cắt tỉa định kỳ. |
t1 | Độ chính xác đơn, mặc định: -1,5 | Khoảng cách T1 cần sử dụng khi dùng phương pháp phân cụm theo tán. Giá trị < 0 được coi là hệ số nhân dương cho T2. |
t2 | Độ chính xác đơn, mặc định: -1 | Khoảng cách T2 cần sử dụng khi sử dụng phương pháp phân cụm tán cây. Các giá trị < 0 sẽ khiến một phương pháp phỏng đoán dựa trên độ lệch chuẩn của thuộc tính được sử dụng. |
distanceFunction | Chuỗi, mặc định: "Euclidean" | Hàm khoảng cách cần sử dụng. Các lựa chọn là: Euclidean và Manhattan. |
maxIterations | Số nguyên, mặc định: null | Số lần lặp lại tối đa. |
preserveOrder | Boolean, mặc định: false | Duy trì thứ tự của các thực thể. |
fast | Boolean, mặc định: false | Cho phép tính toán khoảng cách nhanh hơn bằng cách sử dụng các giá trị ngưỡng. Tắt tính năng tính toán/xuất các lỗi/khoảng cách bình phương. |
seed | Số nguyên, mặc định: 10 | Số ngẫu nhiên để sắp xếp ngẫu nhiên. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eClusters data using the k-means algorithm with either Euclidean (default) or Manhattan distance.\u003c/p\u003e\n"],["\u003cp\u003eIf Manhattan distance is selected, centroids are calculated using the component-wise median instead of the mean.\u003c/p\u003e\n"],["\u003cp\u003eOffers various initialization methods including random, k-means++, canopy, and farthest first.\u003c/p\u003e\n"],["\u003cp\u003eAllows customization of distance calculation, iteration limits, and performance optimization through parameters.\u003c/p\u003e\n"]]],["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"],null,["# ee.Clusterer.wekaKMeans\n\nCluster 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:\n\n\u003cbr /\u003e\n\nD. 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.\n\n| Usage | Returns |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|\n| `ee.Clusterer.wekaKMeans(nClusters, `*init* `, `*canopies* `, `*maxCandidates* `, `*periodicPruning* `, `*minDensity* `, `*t1* `, `*t2* `, `*distanceFunction* `, `*maxIterations* `, `*preserveOrder* `, `*fast* `, `*seed*`)` | Clusterer |\n\n| Argument | Type | Details |\n|--------------------|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `nClusters` | Integer | Number of clusters. |\n| `init` | Integer, default: 0 | Initialization method to use. 0 = random, 1 = k-means++, 2 = canopy, 3 = farthest first. |\n| `canopies` | Boolean, default: false | Use canopies to reduce the number of distance calculations. |\n| `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. |\n| `periodicPruning` | Integer, default: 10000 | How often to prune low density canopies when using canopy clustering. |\n| `minDensity` | Integer, default: 2 | Minimum canopy density, when using canopy clustering, below which a canopy will be pruned during periodic pruning. |\n| `t1` | Float, default: -1.5 | The T1 distance to use when using canopy clustering. A value \\\u003c 0 is taken as a positive multiplier for T2. |\n| `t2` | Float, default: -1 | The T2 distance to use when using canopy clustering. Values \\\u003c 0 cause a heuristic based on attribute std. deviation to be used. |\n| `distanceFunction` | String, default: \"Euclidean\" | Distance function to use. Options are: Euclidean and Manhattan. |\n| `maxIterations` | Integer, default: null | Maximum number of iterations. |\n| `preserveOrder` | Boolean, default: false | Preserve order of instances. |\n| `fast` | Boolean, default: false | Enables faster distance calculations, using cut-off values. Disables the calculation/output of squared errors/distances. |\n| `seed` | Integer, default: 10 | The randomization seed. |"]]