What do online training and offline training mean in deep learning?

Summary: Online training (online learning) only uses part of the data for training, and offline training (offline learning) uses all the data for training. Online learning: After a sample is trained, the weights are updated directly. Offline learning: one sample enters, and the weights are updated only after the entire sample is run.

1、offline training

Offline learning is usually used to train large or complex models, because the training process is often time-consuming and the amount of data processed cannot be completed online. In offline training, all training data must be available during model training. Only after the training is completed, the model can be used. In short, train first, then use the model, and don't use the model until the training is complete.
(Similar to batch learning, assuming that the entire sample has m data, offline training will train an integer multiple of m times, and then bring in the next one until the entire sample is run. At this time, the error rate may not satisfy you. Do the above operations on the entire sample again until the error is small. Offline learning is a batch that updates the weights after training, so all data must be available in each training operation (batch), so that the network will not be brought to extremes due to individual data update errors.)

2、online training

In online learning, the data may be in the form of streaming, such as surveillance video, which has been filmed all the time. We conduct training based on the data we see so far, and the data after a few seconds cannot be used for training . The online algorithm processes the data sequentially. They generate a model and put that model into practice without providing a full training dataset in the first place. The model is continuously updated in operation as more real-time data arrives.
(Usually one piece of data is input at a time (not a batch), and the weights are updated directly after training. The data are processed one by one in order, but the weights will be updated directly after each data training, but I don’t know whether it is right or wrong. If a certain weight update is wrong, the subsequent weight updates may always be wrong, and the final model may gradually go in the wrong direction, and residuals appear. Online learning first processes data in order. They generate a model and put this model in actual operation. There is no need to provide a complete training data set at the beginning. With more real-time data Enter the model, the model will be continuously updated during operation)

3. Give an example

When playing Tetris, you can only see what the current block is (maybe you can see what the next block is), and you need to make a decision based on the current block. This decision-making process based on current information is an online algorithm. When you can know what the entire sequence of blocks is, you may make a different decision, such as "this block can be placed on the left side, so that it can be combined with the block after 10 steps to disappear." This decision-making process based on global information is an offline algorithm (offline algorithm). algorithm).

4. Use

Online learning and offline learning are often used in combination,For example, train a complex model offline and fine-tune it online; Another is to train the model offline, and use the trained model online to make predictions or discrimination.

Guess you like

Origin blog.csdn.net/Adam897/article/details/129908295