[{"data":1,"prerenderedAt":118},["ShallowReactive",2],{"term-k\u002Fk-means":3,"related-k\u002Fk-means":102},{"id":4,"title":5,"acronym":6,"body":7,"category":84,"description":85,"difficulty":86,"extension":87,"letter":88,"meta":89,"navigation":53,"path":90,"related":91,"seo":96,"sitemap":97,"stem":100,"subcategory":6,"__hash__":101},"terms\u002Fterms\u002Fk\u002Fk-means.md","K-Means",null,{"type":8,"value":9,"toc":78},"minimark",[10,15,19,23,26,30,67,71,74],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 - The Vibe Check",[16,17,18],"p",{},"K-Means is a clustering algorithm that groups your data into a set number of buckets without ever being told what the buckets should mean. You say find me 5 groups, and it plants 5 random center points, assigns every data point to its nearest center, moves each center to the middle of the points assigned to it, and repeats until the centers stop moving. You get 5 clusters; figuring out what each one actually represents is on you.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"K-Means is an unsupervised clustering algorithm that partitions data into k groups by iteratively assigning each point to its nearest centroid and recomputing centroids as the mean of their assigned points, until the assignments stabilize. It requires choosing k in advance, commonly guided by the elbow method or silhouette score, and works best when clusters are roughly spherical and similarly sized.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from sklearn.cluster import KMeans\n\nkmeans = KMeans(n_clusters=5, random_state=42)\nlabels = kmeans.fit_predict(X)\n","python","",[38,39,40,48,55,61],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,47],{},"from sklearn.cluster import KMeans\n",[41,49,51],{"class":43,"line":50},2,[41,52,54],{"emptyLinePlaceholder":53},true,"\n",[41,56,58],{"class":43,"line":57},3,[41,59,60],{},"kmeans = KMeans(n_clusters=5, random_state=42)\n",[41,62,64],{"class":43,"line":63},4,[41,65,66],{},"labels = kmeans.fit_predict(X)\n",[11,68,70],{"id":69},"when-youll-hear-this","When You'll Hear This",[16,72,73],{},"\"We ran K-Means on purchase behavior and found 4 pretty distinct customer segments.\" \u002F \"K-Means assumed round, evenly-sized clusters, but our data's shaped nothing like that, results were garbage.\"",[75,76,77],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":50,"depth":50,"links":79},[80,81,82,83],{"id":13,"depth":50,"text":14},{"id":21,"depth":50,"text":22},{"id":28,"depth":50,"text":29},{"id":69,"depth":50,"text":70},"ai","K-Means is a clustering algorithm that groups your data into a set number of buckets without ever being told what the buckets should mean.","intermediate","md","k",{},"\u002Fterms\u002Fk\u002Fk-means",[92,93,94,95],"Principal Component Analysis","Classification","Feature Engineering","Machine Learning",{"title":5,"description":85},{"changefreq":98,"priority":99},"weekly",0.7,"terms\u002Fk\u002Fk-means","T7TCV1EZILmGGRxFc43K_CyNEuBZhyJwqFsiM12vBT4",[103,107,110,114],{"title":93,"path":104,"acronym":6,"category":84,"difficulty":105,"description":106},"\u002Fterms\u002Fc\u002Fclassification","beginner","Classification is teaching an AI to sort things into categories. Is this email spam or not? Is this image a cat, dog, or bird?",{"title":94,"path":108,"acronym":6,"category":84,"difficulty":86,"description":109},"\u002Fterms\u002Ff\u002Ffeature-engineering","Feature engineering is the unglamorous, hugely important work of turning raw, messy real-world data into the specific columns a model can actually learn fr...",{"title":95,"path":111,"acronym":112,"category":84,"difficulty":105,"description":113},"\u002Fterms\u002Fm\u002Fmachine-learning","ML","Machine Learning is teaching a computer by showing it thousands of examples instead of writing out every rule.",{"title":92,"path":115,"acronym":6,"category":84,"difficulty":116,"description":117},"\u002Fterms\u002Fp\u002Fprincipal-component-analysis","advanced","PCA is a way to take data with a hundred confusing, overlapping columns and boil it down to just a handful of new super-columns that capture most of what a...",1792528094451]