ee.Clusterer.wekaKMeans
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ביצוע אשכול נתונים באמצעות אלגוריתם k-means. אפשר להשתמש במרחק האוקלידי (ברירת מחדל) או במרחק מנהטן. אם משתמשים במרחק מנהטן, מרכזי המסה מחושבים כממוצע החציונים של הרכיבים ולא כממוצע. למידע נוסף:
ד. ארתור, ס. Vassilvitskii: k-means++: the advantages of careful seeding. 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) | Clusterer |
ארגומנט | סוג | פרטים |
---|
nClusters | מספר שלם | מספר הצבירים. |
init | מספר שלם, ברירת מחדל: 0 | שיטת האתחול שבה רוצים להשתמש. 0 = אקראי, 1 = k-means++, 2 = canopy, 3 = farthest first. |
canopies | בוליאני, ברירת מחדל: false | אפשר להשתמש בחופות כדי לצמצם את מספר חישובי המרחק. |
maxCandidates | מספר שלם, ברירת מחדל: 100 | המספר המקסימלי של חופות מועמדות שיישארו בזיכרון בכל זמן נתון כשמשתמשים באשכול חופות. המרחק T2 בתוספת מאפייני הנתונים יקבעו כמה חופות מועמדות ייווצרו לפני שיתבצעו גיזום תקופתי וגיזום סופי, מה שעלול לגרום לצריכת זיכרון מוגזמת. ההגדרה הזו מונעת מצבים שבהם מספר גדול של חופות מועמדות צורך זיכרון. |
periodicPruning | מספר שלם, ברירת מחדל: 10,000 | תדירות הגיזום של חופות עם צפיפות נמוכה כשמשתמשים באשכולות חופות. |
minDensity | מספר שלם, ברירת מחדל: 2 | צפיפות מינימלית של חופת העצים, כשמשתמשים באשכולות של חופות עצים, שמתחתיה חופת העצים תיגזם במהלך גיזום תקופתי. |
t1 | מספר ממשי (float), ברירת מחדל: -1.5 | המרחק T1 שמשמש כשמשתמשים בשיטת האשכולות canopy. ערך קטן מ-0 נחשב כמכפיל חיובי ל-T2. |
t2 | מספר ממשי (float), ברירת מחדל: -1 | המרחק T2 שמשמש כשמשתמשים בשיטת האשכולות canopy. ערכים קטנים מ-0 גורמים לשימוש בהיוריסטיקה שמבוססת על סטיית התקן של המאפיין. |
distanceFunction | מחרוזת, ברירת מחדל: Euclidean | פונקציית המרחק שבה רוצים להשתמש. האפשרויות הן: Euclidean ו-Manhattan. |
maxIterations | מספר שלם, ברירת מחדל: null | המספר המקסימלי של איטרציות. |
preserveOrder | בוליאני, ברירת מחדל: false | שמירה על סדר המכונות. |
fast | בוליאני, ברירת מחדל: false | מאפשרת חישובים מהירים יותר של מרחקים, באמצעות ערכי סף. משביתה את החישוב או הפלט של שגיאות או מרחקים בריבוע. |
seed | מספר שלם, ברירת מחדל: 10 | ערך הבסיס לארגון בסדר אקראי. |
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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. |"]]