تنظيم صفحاتك في مجموعات يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يمكن أن تحتوي مجموعات بيانات تعلُّم الآلة على ملايين المثال، ولكن لا يمكن توسيع نطاق بعض خوارزميات التجميع بكفاءة. تُحسِّب العديد من خوارزميات التجميع التشابه بين كل أزواج الأمثلة، ما يؤدي إلى زيادة وقت التشغيل بمعدل مربّع عدد الأمثلة \(n\)، ويُشار إليه باسم \(O(n^2)\) في رمز التعقيد.لا تكون خوارزميات \(O(n^2)\) مفيدة للمجموعات التي تتضمّن ملايين الأمثلة.
تبلغ الصعوبة الحسابية للخوارزمية التصنيفية \(O(n)\)، ما يعني أنّ الخوارزمية تتغيّر بشكل خطي مع \(n\). ستكون هذه الخوارزمية محور هذه الدورة التدريبية.
أنواع التجميع
للحصول على قائمة شاملة بالمناهج المختلفة للتجميع، اطّلِع على A Comprehensive Survey of Clustering Algorithms (استطلاع شامل حول خوارزميات التجميع) الذي كتبه "د. شين تشو". & Tian, Y. منى. بيانات. Sci. (2015) 2: 165. ويكون كلّ منهج مناسبًا بشكلٍ أفضل لتوزيع بيانات معيّن. تتناول هذه الدورة التدريبية بشكل موجز أربعة اتّجاهات شائعة.
التجميع العنقودي المستنِد إلى النقاط المركزية
النقطة المركزية لمجموعة عنقودية هي المتوسّط الحسابي لجميع النقاط في المجموعة. يُنظِّم التجميع المستنِد إلى مركز الكتلة البيانات في مجموعات غير هرمية. تكون خوارزميات التجميع العنقودي المستندة إلى مركز الكتلة فعّالة، ولكنها حسّاسة terhadap الشروط الأولية والقيم الشاذة. ومن بين هذه الخوارزميات، تُعدّ خوارزمية "المركز المتوسط لنقاط متعددة" هي الأكثر استخدامًا. وتتطلّب من المستخدمين تحديد عدد المراكز الحسابية، k، وتعمل بشكل جيد مع المجموعات العنقودية ذات الحجم المتساوٍ تقريبًا.
الشكل 1: مثال على التجميع المستنِد إلى النقطة المركزية
التجميع العنقودي القائم على الكثافة
يربط التجميع العنقودي القائم على الكثافة المناطق المتجاورة ذات الكثافة العالية في نماذج البيانات ببعضها. يتيح ذلك اكتشاف أي عدد من المجموعات العنقودية بأي شكل. لا يتمّ إسناد القيم الشاذّة إلى المجموعات. تواجه هذه الخوارزميات صعوبة في التعامل مع المجموعات ذات الكثافة المختلفة والبيانات ذات السمات العالية.
الشكل 2: مثال للتجميع العنقودي القائم على الكثافة
التجميع العنقودي المستنِد إلى التوزيع
يفترض نهج التجميع هذا أنّ البيانات تتألف من تصاميم احتمالية للتوزيع، مثل تصاميم التوزيع الغاوسي. في الشكل 3، تُجمِّع الخوارزمية المستندة إلى التوزيع البيانات في ثلاثة قواطع Gauss. مع زيادة المسافة من مركز التوزيع، ينخفض احتمال أن تنتمي نقطة إلى التوزيع. توضِّح النطاقات هذا الانخفاض في الاحتمالية. عندما لا تكون مرتاحًا بافتراض ملف شخصي معيّن لتوزيع البيانات الأساسي، عليك استخدام خوارزمية مختلفة.
الشكل 3: مثال على التجميع المستنِد إلى التوزيع
التجميع الهرمي
يُنشئ التجميع الهرمي شجرة من المجموعات العنقودية. ليس من المستغرب أنّ التجميع الهرمي يناسب البيانات الهرمية، مثل التصنيفات. يمكنك الاطّلاع على مقالة مقارنة بين 61 جينومًا من البكتيريا القولونية التي تم تسلسلها التي كتبها Oksana Lukjancenko وTrudy Wassenaar وDave Ussery كمثال. يمكن اختيار أي عدد من المجموعات العنقودية من خلال قطع الشجرة على المستوى المناسب.
الشكل 4: مثال على شجرة هرمية تتضمّن مجموعة من الحيوانات.
تاريخ التعديل الأخير: 2025-06-09 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-06-09 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eMany clustering algorithms have a complexity of O(n^2), making them impractical for large datasets, while the k-means algorithm scales linearly with a complexity of O(n).\u003c/p\u003e\n"],["\u003cp\u003eClustering approaches include centroid-based, density-based, distribution-based, and hierarchical clustering, each suited for different data distributions and structures.\u003c/p\u003e\n"],["\u003cp\u003eCentroid-based clustering, particularly k-means, is efficient for grouping data into non-hierarchical clusters based on the mean of data points, but is sensitive to initial conditions and outliers.\u003c/p\u003e\n"],["\u003cp\u003eDensity-based clustering connects areas of high data density, effectively discovering clusters of varying shapes, but struggles with clusters of differing densities and high-dimensional data.\u003c/p\u003e\n"],["\u003cp\u003eDistribution-based clustering assumes data follows specific distributions (e.g., Gaussian), assigning points based on probability, while hierarchical clustering creates a tree of clusters, suitable for hierarchical data.\u003c/p\u003e\n"]]],[],null,["Machine learning datasets can have millions of\nexamples, but not all clustering algorithms scale efficiently. Many clustering\nalgorithms compute the similarity between all pairs of examples, which\nmeans their runtime increases as the square of the number of examples \\\\(n\\\\),\ndenoted as \\\\(O(n\\^2)\\\\) in complexity notation. \\\\(O(n\\^2)\\\\) algorithms are not\npractical for datasets with millions of examples.\n\nThe [**k-means algorithm**](/machine-learning/glossary#k-means) has a\ncomplexity of \\\\(O(n)\\\\), meaning that the algorithm scales linearly with \\\\(n\\\\).\nThis algorithm will be the focus of this course.\n\nTypes of clustering\n\nFor an exhaustive list of different approaches to clustering, see\n[A Comprehensive Survey of Clustering Algorithms](https://link.springer.com/article/10.1007/s40745-015-0040-1)\nXu, D. \\& Tian, Y. Ann. Data. Sci. (2015) 2: 165. Each approach is best suited to\na particular data distribution. This course briefly discusses four common\napproaches.\n\nCentroid-based clustering\n\nThe [**centroid**](/machine-learning/glossary#centroid) of a cluster is the\narithmetic mean of all the points in the\ncluster. **Centroid-based clustering** organizes the data into non-hierarchical\nclusters. Centroid-based clustering algorithms are efficient but sensitive to\ninitial conditions and outliers. Of these, k-means is the most\nwidely used. It requires users to define the number of centroids, *k*, and\nworks well with clusters of roughly equal size.\n**Figure 1: Example of centroid-based clustering.**\n\nDensity-based clustering\n\nDensity-based clustering connects contiguous areas of high example density into\nclusters. This allows for the discovery of any number of clusters of any shape.\nOutliers are not assigned to clusters. These algorithms have difficulty with\nclusters of different density and data with high dimensions.\n**Figure 2: Example of density-based clustering.**\n\nDistribution-based clustering\n\nThis clustering approach assumes data is composed of probabilistic\ndistributions, such as\n[**Gaussian distributions**](https://wikipedia.org/wiki/Normal_distribution). In\nFigure 3, the distribution-based algorithm clusters data into three Gaussian\ndistributions. As distance from the distribution's center increases, the\nprobability that a point belongs to the distribution decreases. The bands show\nthat decrease in probability. When you're not comfortable assuming a particular\nunderlying distribution of the data, you should use a different algorithm.\n**Figure 3: Example of distribution-based clustering.**\n\nHierarchical clustering\n\n**Hierarchical clustering** creates a tree of clusters. Hierarchical clustering,\nnot surprisingly, is well suited to hierarchical data, such as taxonomies. See\n[*Comparison of 61 Sequenced Escherichia coli Genomes*](https://www.researchgate.net/figure/Pan-genome-clustering-of-E-coli-black-and-related-species-colored-based-on-the_fig1_45152238)\nby Oksana Lukjancenko, Trudy Wassenaar \\& Dave Ussery for an example.\nAny number of clusters can be chosen by cutting the tree at the right level.\n**Figure 4: Example of a hierarchical tree clustering animals.** **Key terms:**\n|\n| - [k-means algorithm](/machine-learning/glossary#k-means)\n| - [centroid](/machine-learning/glossary#centroid)\n| - [Gaussian distributions](/machine-learning/glossary#Normal_distribution)"]]