Large volumes of data are nearly impossible to process using batch learning. Batch learning is the classical process by which we train a model of a given batch of the training data. With tens of millions of data points, Random Forest algorithms, for example, become nearly impossible to compute in a reasonable time.
Therefore, 2 options exist :
- use better hardware: more powerful computers, or parallelized computation. This is however costly, and not always possible.
- build online learning algorithms
What is Online learning?
Online learning is the process by which we :
- make an initial guess model
- pick one observation from the training data and recalibrate the weights on each input parameter
- we make one pass over the data, sequentially, as they come in from the stream
Thanks to Online learning, we are allowed to :
- make one pass on the input data, which is time-efficient
- not store all points in the learning procedure, which is memory efficient
However, when using Online learning :
- the features we previously built might not be relevant anymore
- if the data changes over time, the model is not relevant anymore
- if the network connection is down, the model cannot produce an output anymore
- it is hard to state whether an algorithm performs well since there is no test set typically
Let’s create a small example for classification purposes :
- say that we have 10 voters, i.e people who are going to vote on the classification task
- we initialize the weight of each person to 1
We build a model based on those features :
- if a person is right when predicting the output, we keep its weight constant
- if a person is wrong when predicting the output, we divide its weight by a factor > 1
This way, we are making sure that the weight of the voters that tend to predict the wrong classes is small, whereas the weight of the voters that predict correctly the output remains high
When to use Online Learning
We should use Online Learning when :
- there is too much data to fit in memory, or the training time of a batch learning algorithm takes too long for our application
- the application is itself inherently online
Suppose that we tell someone to randomly say 0 or 1, and try to teach an algorithm to predict what the user is about to say. Using batch learning, the accuracy would typically not exceed 50%. There is however an inherent nonrandomness in the sequences that humans can generate.
That being said, we could be able to develop an algorithm that predicts the right sequence with an accuracy slightly higher than 50%.
Suppose that we try to predict the person’s random sequence with a deterministic strategy : where is the sequence generated by the user and is the corresponding predicted sequence.
We make an average number of mistakes equal to :
If we systematically predict the wrong output, the average loss will be 1.
Using a randomized strategy, our algorithm is denoted by : with
The average number of mistakes we’ll make over a given sequence using this randomized algorithm is now :
An algorithm guessing randomly will systematically reach an average loss of , so there is no longer a “bad sequence” that would lead to an average loss of 1.
We would be winning if you could fin an algorithm for which is always smaller than 50%.
If we consider Randemacher random variables (unbiaised coin flips) , then any algorithm will necessarly make more mistakes on some sequences, and less mistakes on other, with an average of 50% :
In practice, asking a human to produce random sequences brings a bias, since we might find some patterns within the generated sequences. If we care about predicting correctly some sequence, typically the ones generated by humans, while accepting that we’ll perform poorly on others, we might find an algorithm that suits our needs.
We have some idea of the algorithms we’ll encounter in practice. But how do we build an algorithm that takes this into account?
We denote as the target expected value we’d like to achieve on a sequence . In other words, it’s the next value of the sequence. We compute the values of on all such sequences.
In a sense, is a function on the binary hypercube . We define . Under the uniform distribution on ,
Lemma : If , there is a randomized algorithm such that for all sequences.
Corollary : For any and , then, there exists a randomized algorithm making, on average over its randomization, no more than number of mistakes for any sequence.
If we are predicting node labels, for example, we might tilt towards smooth labeling to respect the manifold property and respect an expected homogeneity among a graph structure.
One of the first method to construct a good in to combine several good predictors into a meta-predictor. After that, we may define a collection of ’s that predict human-generated sequences according to some finite state machines and create a meta-predictor that does as well as the best of them on the given sequence.
Performing as well as a finite collection of predictors is called experts setting. Assume that we have access to the predictions of each of the k expert, say . On round , they produce a number, called advice, .
For each , define :
, the performance of expert , which is known only at the end. Our aim is to do as well as the best expert, say :
Under uniform distribution, the expectation of this function is less than . Recall the first corollary, in which we stated that in order to have a decent accuracy on human generated sequences, we need to have . We will add a vanishing term to the expression defined above :
Suppose that we have information that human tend to have an imbalance between the 0’s and the 1’s in the sequences they generate. Then, there is a simple algorithm that will make at most :
The method does not need to know the proportion. If the sequence consists of 80% of 1’s, the algorithm will roughly make 20% of errors if n is large. To conclude this introduction, we can easily build a prediction method that will win over any unbalanced sequence entered by a human.
Conclusion : That’s it ! I hope this introduction to Online Learning was clear. Don’t hesitate to drop a comment if you have any question.
Like it? Buy me a coffee