As Andrew Ng said, data is the new electricity to tackle. As we can see that Machine learning plays a crucial role in AI applications. Traditional machine learning paradigms often work in batch learning or offline learning fashion where a model is trained by some learning algorithm for an entire training dataset at once then afterwards deployed for inference without any scope for any further update. When there is a need for re-training these models to facilitate further changes and those approaching with standard methods are a little complicated and expensive.
Nowadays in the era of big data traditional offline learning methods become more and more restricted especially when live data grows and evolves rapidly. Making machine learning scalable and practical, especially learning from continuous data streams has become an open grand challenge in machine learning and AI. Here in this article, we will discuss in detail online learning with its applications. The major points that we will cover in this article are given below.
Table of Contents
- What is Online Learning?
- Tasks and Applications
- Supervised Learning Task
- Bandit Learning Task
- Unsupervised Learning Task
- Other Learning Task
- Online Vs Offline
- Level of Training and Complexity
- Computational Timing
- Difficulties in Production
- Few Notable Points
- Comparison Table
What is Online Learning?
Traditional machine learning techniques run in batch mode. For example, supervised learning tasks where the complete training data is fed in advance to train a model by applying certain algorithms. Such an approach requires entire training data available prior to the learning task and the process is also in offline mode due to expensive training costs. Conventional techniques suffer from some critical drawbacks like low efficiency in both time and space cost; and poor scalability for large-scale applications because the model often has to retrain from scratch for new data.
On the other hand, online learning is a combination of different techniques of ML where data arrives in sequential order and the learner (algorithm/model) aims to learn and update the best predictor for future data at every step. Online learning is able to overcome drawbacks of offline learning like models can be updated instantly for any change in data. Therefore online learning is far more efficient and scalable for large-scale learning tasks in real-world data, analytics, and various applications where data is not only large in size but also arrives at high velocity.
Tasks and Applications
Similar to the offline learning methods online learning techniques can be applied to solve a variety of tasks and problems of real-world applications, below are some of those;
Supervised Learning Task
One of the most frequent tasks is classification which aims to predict the category of the data points on the basis of past observed data during training whose category labels are given. For e.g, a commonly studied task is binary classification, filtering emails which involves two categories i.e., spam or not spam. Other types of supervised classification tasks such as multi-class, multi-label classification and multiple label classification are included.
In addition to the classification task, there is a regression task as well. Online learning techniques are naturally applied for regression analysis tasks i.e., time series analysis in financial markets where data instances naturally arrive in sequential order. Another is the online portfolio section where a learner aims to find a good strategy for making a sequence decision for portfolio selection.
Bandit Learning Task
Bandit online learning is also known as multi-armed bandits have been extensively used for many online recommendation systems such as online advertising for internet monetization product recommendation in e-commerce, movies recommendation on OTT platform and other personalized recommendation such as YouTube.
Unsupervised Learning Task
Online learning can be applied for unsupervised tasks such as clustering or cluster analysis which is nothing but the process of grouping objects such the object lies in the same group i.e., cluster. Online clustering is carried out by incremental cluster analysis on sequential data which is common for mining data streams.
Other Learning Task
Online learning can also be used for other machine learning tasks such as learning for recommendation systems, learning to rank, or also reinforcement learning. For example, collaborative filtering with online learning can be applied to enhance the performance of recommenders by learning to improve collaborative filtering tasks sequentially from a continuous stream of ratings, feedback from customers.
Last but not the least; Support Vector Machines is well known for supervised learning methods for offline classification tasks, in which classical SVM algorithms suffer from poor scalability for very large scale applications. In literature surveys, various online learning algorithms have been explored for training the SVM in an online learning manner making it more efficient and scalable than conventional offline SVM.
Online Vs Offline
In offline learning models it takes batches of training data to train the learner then tries to generalize using found relationships on the test sample. For online learning, it takes an initial guess of a model and then picks the observation one by one from the training population and generalizes for each observation.
Choosing a mode of learning is an ambiguous question, it merely depends on what your application demands and the rate of dynamicity. In contrast, the following factors play an important role while choosing between online and offline learning modes.
Level of Training and Complexity
While training in offline mode, the weights and parameters of the learner are being updated while simultaneously trying to reach the global minima function on the given dataset. The robustness of the model is achieved by constant and repeated training.
Training in online mode, change in weights and parameters happen at every step especially depending on the current sample under observation and also the current state of the model like this the learner is continuously seeing new data and improving itself which results in this mode as data efficient.
In Offline mode, the complete training data is fed at once to the learning process to adjust weights and parameters automatically which results in faster and cheaper learning. This mode can be used when we are not expecting a dataset from a different probability distribution means the data and its characteristics are the same in the deployed environment.
In the case of Big data where data comes in the stream, feeding these data to an offline model can be quite time-consuming. Whereas our online model is ready to update and tune itself. This may sometimes result in more cost to training because there will be a requirement of a lot of resources to train the model constantly.
Difficulties in Production
Online models are quite difficult to maintain after deployment because the model has to converge all the data points in real-time any changes and ambiguities in data will affect the overall performance and prediction of the data. Therefore it is necessary to monitor the process throughout the time.
However, in offline mode, the model and pattern associated with data are constant after deployment hence it is easier to maintain the system with minimal supervision and control.
Few Notable Points
In online learning, we are making one pass on our data; these algorithms are typically much faster than offline learning as most of the offline learners are multi-pass. Whether it is online or offline we do not consider the training data once it is used, here in online learning the advantage is that data is in sequential order and available for instance so we do not need to store them which results in smaller memory usage.
As said earlier it is difficult to maintain in a production environment as data points tend to change continuously and there is a high chance of mismatching the pattern and distribution of data. If there is a major network latency issue or server goes down or any other ambiguity can result in complete failure of the project.
It can be difficult to see whether our learner is behaving correctly or not on an automatic basis. Also hard to diagnose whether the algorithm is misbehaving or not.
Comparing Online Vs Offline Learning
|Features||Online Learning||Offline Learning|
|Applications||Used in the finance market, economics, where new data is emerging||Various classification tasks based on images, regression tasks, all standard ML tasks|
|Production difficulty||Difficult to maintain, and manage||Easy as there are many plugin supports|
|Complexity||As parameters are changing results dynamic complexity||Less complex as parameters are constant once learned|
|Tools||New tools such as MOA, scikit multi-flow etc||Scikit, TensorFlow, Keras, Pytorch|
From this article we have seen what is called Online machine learning, we have clearly seen what tasks and applications can be facilitated with it and also seen the similarities between the two techniques i.e., Online and offline. It is clear that the use of Online learning is more beneficial in live analysis, recommendation systems, financial markets etc.