Course contentsShow
← Machine Learning and Deep Learning
Lesson 132 of 3,5382. Machine Learning Mindset and Core ConceptsFree lesson

Online Learning: Updating Models in Real-Time

Understand how models can learn incrementally from streaming data rather than batch training.

Online Learning: Updating Models in Real-Time

What you'll learn: How machine learning models can continuously update themselves as new data arrives, rather than waiting to retrain on complete datasets.

The Core Idea

In most machine learning scenarios we've considered so far, you collect a large dataset, train your model once (or a few times), and deploy it. But what if data keeps flowing in—like stock prices, user clicks, or sensor readings? Online learning means your model updates incrementally with each new example (or small batch) as it arrives, adapting in real-time without needing to retrain from scratch on all historical data.

Think of it like learning to cook: batch learning is like taking a cooking class once a year where you practice 100 recipes together. Online learning is like cooking dinner every night and adjusting your technique based on how last night's meal turned out—you improve continuously, one meal at a time.

Why It Matters

Online learning is essential when:

  • Data arrives continuously (streaming data)
  • Storing all historical data is impractical
  • Patterns change over time (concept drift)
  • You need immediate adaptation to new information

For example, a spam filter using online learning can immediately incorporate feedback when you mark an email as spam, updating its understanding of what spam looks like without retraining on millions of old emails.

Connection to What You Know

Remember Stochastic Gradient Descent (SGD)? It's actually a form of online learning! SGD updates model parameters after each example (or mini-batch), making it naturally suited for streaming scenarios. The optimization principles you've learned—gradients, learning rates, convergence—all apply here, but now the data distribution might shift over time.

Key Takeaway: Online learning enables models to adapt continuously as new data streams in, updating incrementally rather than requiring complete retraining—essential for real-time applications and evolving data patterns.