3
$\begingroup$

I am new to deep learning. Can anybody help me with the online learning implimentation for deep learning models. As per my understanding, i can save a keras/tensorflow model after training and when new data comes in, i can reload the network back and retrain the network using the new data. I haven’t seen anywhere documenting this method. Is my understanding incorrect? If yes, let me know what can be done so that the model keeps on getting retrained when new data comes in?

$\endgroup$

3 Answers 3

1
$\begingroup$

Its extremely simple. There are a lot of ways of doing it. I am assuming you are familiar with Stochastic Gradient Descent. I am going to tell one naive way of doing it.

  • Reload the model into RAM.

  • Write a SGD function like SGD(X,y). It will take the new sample and label and run one step of SGD on it and save the updated model.

  • As you can see this will be highly inefficient, a better way is to save a number of samples and then run a step of stochastic batch gradient descent on it. So that you dont have to reload the updated model every time you give it a new sample.

I hope this gives you a rough idea of how the implementation can be done. You can easily find much more efficient and scalable ways of doing this. If you are not familiar waith algorithms like SGD, I would recommend to get familiar with them because online learning is just a one sample mini batch gradient descent algorithm.

$\endgroup$
1
$\begingroup$

Yes, there is some methods to do this based on the library. The proper keyword for this functionality is Checkpoint. Hence, you can check functions to save or restore the checkpoints from hard disk to continue learning or prediction in a new session. For example you can see the following in Tensorflow:

The tf.train.Saver class provides methods for saving and restoring models. The tf.train.Saver constructor adds save and restore ops to the graph for all, or a specified list, of the variables in the graph. The Saver object provides methods to run these ops, specifying paths for the checkpoint files to write to or read from.

For more details about this in Tensorflow, you can follow this link.

To complete the case you can follow this subject in another library such as CNTK in this link.

$\endgroup$
0
$\begingroup$

Having more data may not mean that you have online learning. Above answers are correct if you assume that the coming new data samples will not have any concept drift. Meaning the true data generating distribution may change in a way that your current ( most recent model) is in a point that is very far away from the optimal minimum for the new data distribution. I recommend you to read more about “concept drift” and understand if your data will have any concept drift. Try to search for how NN deals with concept drifts. Unfortunately I am not aware of any technique or method can make NN adapt to concept drift. If you do not expect any concept drift, then saving the check point and continue training will be good solution if you are using stochastic gradient descent

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.