{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4e38ba0e",
   "metadata": {},
   "source": [
    "# Clustering\n",
    "\n",
    "This chapter introduces clustering as unsupervised learning. You will use k-means to group observations, interpret cluster centers, and evaluate whether the resulting groups make practical sense.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "425d9b54",
   "metadata": {},
   "source": [
    "<h2>Chapter Video</h2>\n",
    "\n",
    "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube-nocookie.com/embed/4b5d3muPQmA\" title=\"StatQuest: K-means clustering\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen referrerpolicy=\"strict-origin-when-cross-origin\"></iframe>\n",
    "\n",
    "<div class=\"video-credit\">\n",
    "<p><strong>Video credit:</strong> StatQuest with Josh Starmer. <em>K-means clustering</em>. YouTube. <a href=\"https://youtube.com/watch?v=4b5d3muPQmA\">Watch on YouTube</a>.</p>\n",
    "<p class=\"video-rights\">This embedded video is provided for educational reference only. All rights are retained by the respective copyright holder.</p>\n",
    "</div>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "79c46643",
   "source": "```{contents}\n:local:\n:depth: 2\n```",
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "id": "ac0bafc5",
   "metadata": {},
   "source": [
    "<h2>Learning Objectives</h2>\n",
    "\n",
    "By the end of this chapter, you will be able to:\n",
    "\n",
    "1. Explain clustering as grouping observations without known labels.\n",
    "2. Describe the k-means algorithm in terms of centers and assignments.\n",
    "3. Prepare numeric features so distance-based clusters are meaningful.\n",
    "4. Interpret cluster centers and cluster membership in an applied context.\n",
    "5. Evaluate clusters with metrics and domain judgment.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f183dbf1",
   "metadata": {},
   "source": [
    "<h2>Chapter Flow</h2>\n",
    "\n",
    "```{div} chapter-flow\n",
    "{doc}`Clustering Concepts <1501-clustering-concepts>`\n",
    "\n",
    "{doc}`K-Means Workflow <1502-k-means-workflow>`\n",
    "\n",
    "{doc}`Interpreting Clusters <1503-interpreting-clusters>`\n",
    "```\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d49042e9",
   "metadata": {},
   "source": [
    "<h2>Glossary</h2>\n",
    "\n",
    "| # | Term | Explanation |\n",
    "|---:|---|---|\n",
    "| 1 | Clustering | Grouping observations based on similarity. |\n",
    "| 2 | Unsupervised learning | Learning patterns from data without known target labels. |\n",
    "| 3 | Cluster | A group of observations that are similar to each other. |\n",
    "| 4 | K-means | A clustering algorithm that partitions data into k groups. |\n",
    "| 5 | Centroid | The center point of a k-means cluster. |\n",
    "| 6 | Assignment step | The k-means step that assigns observations to nearest centroids. |\n",
    "| 7 | Update step | The k-means step that recalculates centroids. |\n",
    "| 8 | Distance metric | A rule for measuring how far observations are apart. |\n",
    "| 9 | Euclidean distance | Straight-line distance between points. |\n",
    "| 10 | Feature scaling | Transforming variables so their scales are comparable. |\n",
    "| 11 | Standardization | Scaling values by subtracting a mean and dividing by a standard deviation. |\n",
    "| 12 | Within-cluster variation | How spread out points are inside a cluster. |\n",
    "| 13 | Silhouette score | A metric comparing within-cluster fit with separation from other clusters. |\n",
    "| 14 | Elbow method | A heuristic for choosing k by inspecting improvement as k increases. |\n",
    "| 15 | Initialization | The starting placement of cluster centers. |\n",
    "| 16 | Convergence | The point when assignments and centers stop changing much. |\n",
    "| 17 | Dimensionality | The number of features used to represent observations. |\n",
    "| 18 | Segmentation | Using clusters to divide customers, products, or cases into groups. |\n",
    "| 19 | Interpretability | How easily cluster results can be explained. |\n",
    "| 20 | Domain judgment | Subject-matter reasoning used to decide whether clusters are useful. |\n",
    "| 21 | Noisy feature | A variable that adds distraction rather than useful grouping information. |\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "72db2fe2",
   "metadata": {},
   "source": [
    "<h2><a href=\"overview.html\" target=\"_blank\" rel=\"noopener noreferrer\">Chapter Overview Slides</a></h2>\n"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
