Skip to main content

Batch and Online Learning

 

It is the criterion used to classify Machine Learning systems is whether or not the system can learn incrementally from a stream of incoming data.



Batch learning

In batch learning, the system is incapable of learning incrementally: it must be trained using all the available data. This will generally take a lot of time and computing resources, so it is typically done offline. First the system is trained, and then it is launched into production and runs without learning anymore; it just applies what it has learned. This is called offline learning. If you want a batch learning system to know about new data (such as a new type of spam), you need to train a new version of the system from scratch on the full dataset (not just the new data, but also the old data), then stop the old system and replace it with the new one.

Fortunately, the whole process of training, evaluating, and launching a Machine Learning system can be automated fairly easily (as shown in
Figure 1-3), so even a batch learning system can adapt to change. Simply update the data and train a new version of the system from scratch as often as needed.
This solution is simple and often works fine, but training using the full set of data can take many hours, so you would typically train a new system only every 24 hours or even just weekly. If your system needs to adapt to rapidly changing data (e.g., to predict stock prices), then you need a more reactive solution.

Also, training on the full set of data requires a lot of computing resources (CPU, memory space, disk space, disk I/O, network I/O, etc.). If you have a lot of data and you automate your system to train from scratch every day, it will end up costing you a lot of money. If the amount of data is huge, it may even be impossible to use a batch learning algorithm.

Finally, if your system needs to be able to learn autonomously and it has limited resources (e.g., a smartphone application or a rover on Mars), then carrying around large amounts of training data and taking up a lot of resources to train for hours every day is a showstopper. 

Fortunately, a better option in all these cases is to use algorithms that are capable of learning incrementally. 

Online learning

In online learning, you train the system incrementally by feeding it data instances sequentially, either individually or by small groups called minibatches. Each learning step is fast and cheap, so the system can learn about new data on the fly, as it arrives in the below picture.



Online learning is great for systems that receive data as a continuous flow (e.g., stock prices) and need to adapt to change rapidly or autonomously. It is also a good option if you have limited computing resources: once an online learning system has learned about new data instances, it does not need them anymore, so you can discard them (unless you want to be able to roll back to a previous state
and “replay” the data). This can save a huge amount of space. Online learning algorithms can also be used to train systems on huge datasets that cannot fit in one machine’s main memory (this is called
out-of-core learning). The algorithm loads part of the data, runs a training step on that data, and repeats the process until it has run on all of the data

Online learning is great for systems that receive data as a continuous flow (e.g., stock prices) and need to adapt to change rapidly or autonomously. It is also a good option if you have limited computing resources: once an online learning system has learned about new data instances, it does not need them anymore, so you can discard them (unless you want to be able to roll back to a previous state
and “replay” the data). This can save a huge amount of space. Online learning algorithms can also be used to train systems on huge datasets that cannot fit in one machine’s main memory (this is called
out-of-core learning). The algorithm loads part of the data, runs a training step on that data, and repeats the process until it has run on all of the data.


Scene From Bicycle Thieves



Comments

Popular posts from this blog

What is text.similar() & text.common_contexts() of nltk

Let's first define our input text, I will just Copy/Paste the first paragraph of  Game of Thrones Wikipedia page : input_text = "Game of Thrones is an American fantasy drama television series \ created by David Benioff and D. B. Weiss for HBO. It is an adaptation of A Song \ of Ice and Fire, George R. R. Martin's series of fantasy novels, the first of \ which is A Game of Thrones. The show was filmed in Belfast and elsewhere in the \ United Kingdom, Canada, Croatia, Iceland, Malta, Morocco, Spain, and the \ United States.[1] The series premiered on HBO in the United States on April \ 17, 2011, and concluded on May 19, 2019, with 73 episodes broadcast over \ eight seasons. Set on the fictional continents of Westeros and Essos, Game of \ Thrones has several plots and a large ensemble cast, and follows several story \ arcs. One arc is about the Iron Throne of the Seven Kingdoms, and follows a web \ of alliances and conflicts among the noble dynasties either vying to claim the