K-means is an essential algorithm for Data Science.

But it's confusing for beginners.

Let me demolish your confusion: Image
1. K-Means

K-means is a popular unsupervised machine learning algorithm used for clustering. It's a core algorithm used for customer segmentation, inventory categorization, market segmentation, and even anomaly detection. Image
2. Unsupervised:

K-means is an unsupervised algorithm used on data with no labels or predefined outcomes. The goal is not to predict a target output, but to explore the structure of the data by identifying patterns, clusters, or relationships within the dataset.
3. Objective Function:

The objective of K-means is to minimize the within-cluster sum of squares (WCSS). It does this though a series of iterative steps that include Assignments and Updated Steps. Image
4. Assignment Step:

In this step, each data point is assigned to the nearest cluster centroid. The "nearest" is typically determined using the Euclidean distance. Image
5. Update Step:

Recalculate the centroids as the mean of all points in the cluster. Each centroid is the average of the points in its cluster.
6. Iterate Step(s):

The assignment and update steps are repeated until the centroids no longer change significantly, indicating that the clusters are as good as stable. This process minimizes the within-cluster variance.
7. Silhouette Score (Evaluation):

This metric measures how similar a data point is to its own cluster compared to other clusters. The silhouette score ranges from -1 to 1, where a high value indicates that the data point is well-matched to its own cluster and poorly matched to neighboring clusters.Image
8. Elbow Method (Evaluation):

This method involves plotting the inertia as a function of the number of clusters and looking for an 'elbow' in the graph. The elbow point, where the rate of decrease sharply changes, can be a good choice for the number of clusters. Image
9. There's a new problem that has surfaced --

Companies NOW want AI.

AI is the single biggest force of our decade. Yet 99% of data scientists are ignoring it.

That's a huge advantage to you. I'd like to help.
Want to become a Generative AI Data Scientist in 2025 ($200,000 career)?

On Wednesday, Sept 3rd, I'm sharing one of my best AI Projects: How I built an AI Customer Segmentation Agent with Python

Register here (limit 500 seats): learn.business-science.io/registration-a…Image
That's a wrap! Over the next 24 days, I'm sharing the 24 concepts that helped me become an AI data scientist.

If you enjoyed this thread:

1. Follow me @mdancho84 for more of these
2. RT the tweet below to share this thread with your audience
P.S. Want free AI, Machine Learning, and Data Science Tips with Python code every Sunday?

Don't forget to sign up for my AI/ML Tips Newsletter Here: learn.business-science.io/free-ai-tips

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with 🔥 Matt Dancho (Business Science) 🔥

🔥 Matt Dancho (Business Science) 🔥 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @mdancho84

Feb 5
OpenAI, Google, and Anthropic just published guides on:

• Prompt engineering
• Building agents
• AI in business
• 601 AI use cases

9 of the best guides you can't miss: Image
1. AI in the Enterprise by OpenAI

Grab the PDF: cdn.openai.com/business-guide…Image
2. A practical guide to building agents by OpenAI

Download here: cdn.openai.com/business-guide…
Read 14 tweets
Feb 2
🚨McKinsey just dropped how to build agentic AI (that works)

Here's everything you need to know in 2 minutes: Image
1. Stop building agents; Start fixing workflows

The mistake every organization makes: falling in love with your new AI agent.

The solution: Identify the pain points in your process. Then use agents to connect analytics and gen AI into 1 seamless process.
2. Not everything needs an Agent

Stop agent-ifying everything.

Ask: "Is this a problem that actually needs solving with agents?"

Alternatives to Agents:

- Automation
- NLP
- Basic Gen AI
- Predictive Analytics
Read 10 tweets
Jan 22
This 277-page PDF unlocks the secrets of Large Language Models.

Here's what's inside: 🧵 Image
Chapter 1 introduces the basics of pre-training.

This is the foundation of large language models, and common pre-training methods and model architectures will be discussed here. Image
Chapter 2 introduces generative models, which are the large language models we commonly refer to today.

After presenting the basic process of building these models, you explore how to scale up model training and handle long texts. Image
Read 10 tweets
Jan 21
RIP BI Dashboards.

Tools like Tableau and PowerBI are about to become extinct.

This is what's coming (and how to prepare): Image
I've never been a fan of Tableau and PowerBI.

Static dashboards don't answer dynamic business questions.

That's why a new breed of analytics is coming: AI Analytics. Image
AI + Data Science is the future:

AI tools like:

- LangChain
- LangGraph
- OpenAI API

Are being combined with:

- SQL Databases
- Machine Learning
- Prediction

And the results are exactly what businesses need: real-time predictive insights. Image
Read 7 tweets
Jan 18
A Research Scientist at Google DeepMind just dropped a 58 page paper on building agents that specialize in game theory.

Here are the most important parts: Image
The problem with existing agents - You need to prompt the LLM to generate actions.

But this doesn't work in games that have perfect or imperfect information.

Instead, they implement a trick:
To describe a complex "world model", researchers simplify as a Partially Observed Stochastic Game.

It's represented below as a causal graph. Image
Read 9 tweets
Jan 18
Stanford just dropped a 457 page report on AI.

It's packed with data on: cost drops, efficiency, benchmarks, adoption.

This report is a cheat code for your career in 2026.

I pulled the most important charts + what they mean for your career: 🧵 Image
First: this isn’t “AI hype.”

It’s measured trends on what’s getting cheaper, what’s getting better, and what’s spreading across the economy and regulation.

(Bookmark this. You’ll reuse it.)
1. Cost + efficiency

The quiet story of 2025: AI is getting dramatically cheaper + more efficient.

The report estimates price-performance improved ~30% per year and energy efficiency improved ~40% annually.

That’s why AI is moving from “demo” to “default.”
Read 16 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(