{
  "source_file": "0930",
  "source_platform": "Hashnode",
  "author": "Muhammad Fahad Bashir",
  "title_listed": "An Introductory Overview of Unsupervised Learning",
  "keywords": "",
  "domain": "机器学习",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://ml-diaries-by-fahd.hashnode.dev/an-introductory-overview-of-unsupervised-learning",
  "publish_date": "2025-10-15",
  "corpus_stage": "",
  "notes": "",
  "id": "99a8ebaf96b9",
  "collected_at": "2026-10-02T14:10:54",
  "title": "An Introductory Overview of Unsupervised Learning",
  "body_markdown": "An Introductory Overview of Unsupervised Learning\nUpdated\nOctober 15, 2025\n•\n4\nmin read\n•\nView as Markdown\nM\nMuhammad Fahad Bashir\nMachine Learning, Artificial Intelligence\nPart of series\nUnsupervised Learning\nIn the\nsupervised learning series\n, we learned how models use labeled data to make predictions where both inputs and outputs are known. But what if we only have\nraw data\n, with no labels or outcomes defined?\nThat’s where\nUnsupervised Learning\ncomes in.\nIt’s a type of machine learning that helps us\ndiscover hidden patterns, relationships, and structures\nin data without any predefined categories or human guidance.\nWhat Is Unsupervised Learning?\nUnsupervised learning algorithms work solely with\ninput data\n, without any labeled responses.\nTheir main goal is to\nexplore the data\nand find patterns that help us understand how information is grouped or related.\nFor example:\nImagine having thousands of animal photos but no labels like “cat,” “dog,” or “bird.”\nAn unsupervised algorithm can automatically group similar images together — all cats in one group, all dogs in another — purely by analyzing patterns in the data.\nTypes of Unsupervised Learning\nWhile many resources introduce unsupervised learning mainly through\nclustering\n, the broader category actually includes\nthree major types\nthat includes clustering, association rule learning, and dimensionality reduction.\nClustering:\nGroups similar data points together based on shared characteristics.\n(\n**Example:\ngrouping customers based on purchase behavior)\nAssociation Rule Learning:\nFinds relationships and co-occurrences between features.\n(Example: people who buy bread often buy butter)\nDimensionality Reduction:\nSimplifies complex datasets by reducing the number of features while keeping the important information.\n(Example: compressing high-dimensional data for visualization or faster processing)\nGeneral Workflow of Unsupervised Learning\nHere’s a simple step-by-step view of how an unsupervised learning algorithm works:\nCollect Unlabeled Data\nGather data with no predefined outputs.\nExample: customer profiles, images, sensor data.\nChoose the Right Algorithm\nDepending on your goal — cluster similar data, find associations, or reduce dimensions — choose algorithms like\nK-Means\n,\nApriori\n, or\nPCA\n.\nTrain the Model\nThe algorithm analyzes the dataset and tries to find hidden structures, similarities, or groups — without any human supervision.\nGroup or Transform Data\nIt organizes data into\nclusters\n,\nrules\n, or\nreduced forms\nfor visualization or further use.\nInterpret the Results\nThe final step is understanding the results — identifying patterns, interpreting clusters, and gaining insights for decision-making.\nCommon Algorithms & Their Purpose\n1. Clustering Algorithms\nUsed to group similar data points together.\nK-Means Clustering:\nDivides data into\nk\nclusters based on distance between points.\nHierarchical Clustering:\nBuilds clusters step by step like a tree.\nDBSCAN:\nFinds clusters in dense regions and treats outliers as noise.\nMean-Shift & Spectral Clustering:\nHandle complex patterns and overlapping groups.\nExample:\nGrouping customers by spending behavior in an e-commerce store.\n2. Association Rule Learning\nFinds interesting relationships between variables in a dataset.\nApriori Algorithm:\nExplores frequent itemsets step by step.\nFP-Growth:\nFaster and more efficient for large datasets.\nExample:\nIn a supermarket dataset, finding that “customers who buy milk often buy cereal.”\n3. Dimensionality Reduction\nSimplifies data while keeping it meaningful.\nPCA (Principal Component Analysis):\nConverts data into fewer “principal” components.\nLDA, NMF, LLE:\nDifferent techniques to reduce complexity and visualize data.\nExample:\nReducing 1000 features in an image dataset to 2D for visualization.\nReal-World Applications of Unsupervised Learning\nCustomer Segmentation:\nGrouping customers for personalized marketing.\nAnomaly Detection:\nDetecting fraud or unusual patterns in financial transactions.\nRecommendation Systems:\nSuggesting movies, songs, or products based on similarities.\nImage & Text Clustering:\nOrganizing untagged photos or documents.\nSocial Network Analysis:\nIdentifying communities and trends online.\nExample: Unsupervised Learning in Python\nLet’s look at a simple\nK-Means Clustering\nexample using the famous\nIris dataset\n.\nWe’ll group flowers into clusters based on their petal and sepal measurements — without knowing their species labels.\n# --- Import Required Libraries ---\nimport\npandas\nas\npd\nimport\nmatplotlib.pyplot\nas\nplt\nimport\nseaborn\nas\nsns\nfrom\nsklearn.datasets\nimport\nload_iris\nfrom\nsklearn.cluster\nimport\nKMeans\n# --- Load the Iris Dataset ---\ndata = load_iris()\nX = pd.DataFrame(data.data, columns=data.feature_names)\n# --- Apply K-Means Clustering ---\nkmeans = KMeans(n_clusters=\n3\n, random_state=\n42\n)\nkmeans.fit(X)\n# --- Add Predicted Cluster Labels to the DataFrame ---\nX[\n'Cluster'\n] = kmeans.labels_\n# --- Add Actual Species Names for Comparison ---\nX[\n'Actual'\n] = [data.target_names[i]\nfor\ni\nin\ndata.target]\n# --- Display the First Few Rows of the Dataset ---\nprint(\n\"Sample of clustered data:\"\n)\nprint(X.head())\nprint(\n\"\\nCluster Centers:\"\n)\nprint(kmeans.cluster_centers_)\n# --- Visualization 1: K-Means Clusters ---\nplt.figure(figsize=(\n8\n,\n6\n))\nsns.scatterplot(\n    data=X,\n    x=\n'petal length (cm)'\n,\n    y=\n'petal width (cm)'\n,\n    hue=\n'Cluster'\n,\n    palette=\n'viridis'\n,\n    s=\n80\n)\nplt.title(\n\"K-Means Clustering on Iris Dataset\"\n, fontsize=\n14\n)\nplt.xlabel(\n\"Petal Length (cm)\"\n)\nplt.ylabel(\n\"Petal Width (cm)\"\n)\nplt.legend(title=\n\"Cluster\"\n, loc=\n\"upper left\"\n)\nplt.show()\n# --- Visualization 2: Actual Species ---\nplt.figure(figsize=(\n8\n,\n6\n))\nsns.scatterplot(\n    data=X,\n    x=\n'petal length (cm)'\n,\n    y=\n'petal width (cm)'\n,\n    hue=\n'Actual'\n,\n    palette=\n'Set2'\n,\n    s=\n80\n)\nplt.title(\n\"Actual Iris Species\"\n, fontsize=\n14\n)\nplt.xlabel(\n\"Petal Length (cm)\"\n)\nplt.ylabel(\n\"Petal Width (cm)\"\n)\nplt.legend(title=\n\"Species\"\n, loc=\n\"upper left\"\n)\nplt.show()\nConclusion\nUnsupervised Learning is all about\nexploration and discovery,\nfinding what’s hidden in your data without explicit labels. It’s the foundation for clustering, pattern detection, and insights generation. In this new\nUnsupervised Learning series\n, we’ll go deeper into each category.\nStay tuned — next, we’ll explore how K-Means actually forms clusters and how to visualize them beautifully in Python.\n#\nmachine-learning\n#\nunsupervised-learning\n#\ntutorial\n#\nbeginner\n#\nartificial-intelligence\n#\ntypes-of-machine-learning\n20\nviews",
  "metadata": {
    "title": "An Introductory Overview of Unsupervised Learning",
    "description": "Discover how unsupervised learning reveals hidden data patterns without labels, including clustering, association rules, and dimensionality reduction",
    "keywords": null,
    "author": null,
    "og:title": "An Introductory Overview of Unsupervised Learning",
    "og:description": "Discover how unsupervised learning reveals hidden data patterns without labels, including clustering, association rules, and dimensionality reduction",
    "og:url": "https://ml-diaries-by-fahd.hashnode.dev/an-introductory-overview-of-unsupervised-learning",
    "og:site_name": "ML Diaries by Fahd",
    "og:image": "https://cdn.hashnode.com/res/hashnode/image/upload/v1760514121784/0997002b-f5fb-477f-98f6-ab82e5f1cd06.png",
    "og:image:width": "1200",
    "og:image:height": "630",
    "og:type": "article",
    "twitter:card": "summary_large_image",
    "twitter:title": "An Introductory Overview of Unsupervised Learning",
    "twitter:description": "Discover how unsupervised learning reveals hidden data patterns without labels, including clustering, association rules, and dimensionality reduction",
    "twitter:image": "https://cdn.hashnode.com/res/hashnode/image/upload/v1760514121784/0997002b-f5fb-477f-98f6-ab82e5f1cd06.png",
    "article:published_time": "2025-10-15T07:43:02.452Z",
    "article:modified_time": "2025-10-15T10:25:07.424Z",
    "article:author": "https://ml-diaries-by-fahd.hashnode.dev/@mfahadbashir"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/99a8ebaf96b9/code/body-000.txt",
      "chars": 1503,
      "language": "text"
    }
  ],
  "images": [
    {
      "status": "ok",
      "url": "https://cdn.hashnode.com/res/hashnode/image/upload/v1760514121784/0997002b-f5fb-477f-98f6-ab82e5f1cd06.png",
      "bytes": 782719,
      "reused": true,
      "local_path": "attachments/99a8ebaf96b9/images/002.png",
      "src": "https://cdn.hashnode.com/res/hashnode/image/upload/v1760514121784/0997002b-f5fb-477f-98f6-ab82e5f1cd06.png",
      "alt": "An Introductory Overview of Unsupervised Learning",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://media.geeksforgeeks.org/wp-content/uploads/20250903113035199927/Unsupervised-Learning.webp",
      "bytes": 18252,
      "reused": true,
      "local_path": "attachments/99a8ebaf96b9/images/004.webp",
      "src": "https://media.geeksforgeeks.org/wp-content/uploads/20250903113035199927/Unsupervised-Learning.webp",
      "alt": "Unsupervised-Learning",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://www.ejable.com/wp-content/uploads/2023/11/Unsupervised-Machine-Learning-5a.webp",
      "bytes": 26714,
      "reused": true,
      "local_path": "attachments/99a8ebaf96b9/images/005.webp",
      "src": "https://www.ejable.com/wp-content/uploads/2023/11/Unsupervised-Machine-Learning-5a.webp",
      "alt": "Types of Machine Learning: All You Want to Know | EJable",
      "downloaded": true
    },
    {
      "status": "ok",
      "url": "https://cdn.hashnode.com/res/hashnode/image/upload/v1760513804586/47f2321d-9032-4722-b221-b11d17facd32.png",
      "bytes": 51817,
      "reused": true,
      "local_path": "attachments/99a8ebaf96b9/images/006.png",
      "src": "https://cdn.hashnode.com/res/hashnode/image/upload/v1760513804586/47f2321d-9032-4722-b221-b11d17facd32.png",
      "alt": "",
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [],
  "links": [
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/an-introductory-overview-of-unsupervised-learning.md",
      "label": "View as Markdown",
      "type": "a"
    },
    {
      "href": "https://hashnode.com/@mfahadbashir",
      "label": "M",
      "type": "a"
    },
    {
      "href": "https://www.linkedin.com/in/muhammad-fahad-bashir-09568216a/",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/series/unsupervisedlearning",
      "label": "Part of series Unsupervised Learning",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/series/supervised-learning",
      "label": "supervised learning series",
      "type": "a"
    },
    {
      "href": "https://www.geeksforgeeks.org/machine-learning/unsupervised-learning/",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://www.ejable.com/tech-corner/ai-machine-learning-and-deep-learning/types-of-machine-learning/",
      "label": "",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/tag/machine-learning",
      "label": "# machine-learning",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/tag/unsupervised-learning",
      "label": "# unsupervised-learning",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/tag/tutorial",
      "label": "# tutorial",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/tag/beginner",
      "label": "# beginner",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/tag/artificial-intelligence",
      "label": "# artificial-intelligence",
      "type": "a"
    },
    {
      "href": "https://ml-diaries-by-fahd.hashnode.dev/tag/types-of-machine-learning",
      "label": "# types-of-machine-learning",
      "type": "a"
    }
  ],
  "retry_at": "2026-10-03T08:07:29",
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:50:42Z",
  "source_url": "https://ml-diaries-by-fahd.hashnode.dev/an-introductory-overview-of-unsupervised-learning",
  "papers": [],
  "actual_video_files": [],
  "body_chars": 6540,
  "expected_body_images": 4,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/99a8ebaf96b9/pages/source.html",
  "local_html": "attachments/99a8ebaf96b9/pages/article.html",
  "body_base_path": "attachments/99a8ebaf96b9/pages/",
  "body_markdown_path": "attachments/99a8ebaf96b9/pages/article.md"
}