ee.Clusterer.wekaKMeans
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
จัดกลุ่มข้อมูลโดยใช้อัลกอริทึม K-means ใช้ได้ทั้งระยะทางแบบยุคลิด (ค่าเริ่มต้น) หรือระยะทางแบบแมนฮัตตัน หากใช้ระยะทางแมนฮัตตัน ระบบจะคำนวณจุดศูนย์กลางเป็นค่ามัธยฐานแบบคอมโพเนนต์แทนค่าเฉลี่ย ดูข้อมูลเพิ่มเติมได้ที่
ง. Arthur, S. Vassilvitskii: k-means++: the advantages of careful seeding. ใน: 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) | Clusterer |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
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 ที่จะใช้เมื่อใช้การจัดกลุ่ม Canopy ระบบจะถือว่าค่าที่น้อยกว่า 0 เป็นตัวคูณบวกสำหรับ T2 |
t2 | Float, ค่าเริ่มต้น: -1 | ระยะทาง T2 ที่จะใช้เมื่อใช้การจัดกลุ่ม Canopy ค่า < 0 จะทำให้ระบบใช้ฮิวริสติกตามค่าเบี่ยงเบนมาตรฐานของแอตทริบิวต์ |
distanceFunction | String, ค่าเริ่มต้น: "Euclidean" | ฟังก์ชันระยะทางที่จะใช้ ตัวเลือกคือ "ยุคลิด" และ "แมนฮัตตัน" |
maxIterations | จำนวนเต็ม ค่าเริ่มต้น: null | จำนวนการวนซ้ำสูงสุด |
preserveOrder | บูลีน ค่าเริ่มต้น: false | รักษลําดับของอินสแตนซ์ |
fast | บูลีน ค่าเริ่มต้น: false | ช่วยให้คำนวณระยะทางได้เร็วขึ้นโดยใช้ค่าตัด ปิดใช้การคำนวณ/เอาต์พุตของข้อผิดพลาด/ระยะทางยกกำลังสอง |
seed | จำนวนเต็ม ค่าเริ่มต้น: 10 | ค่าเริ่มต้นของการสุ่ม |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 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. |"]]