repeat with training steps: epoch not necessarily equals one trip
Dataset. repeat allows the data to be returned to the tail.
Learning objectives and first steps2 objectives 2 first fixes
Try to do it after reading
- Calculate the number of batches of duplicate data streams
- Clear sample through epoch border with the training log
Suggested first
- Python Basic Syntax:
- Counting and training closed
Unlimited data stream does not have a natural end
Dataset. repeat allows the data to be returned to the tail. Once repeated indefinitely, consumers cannot rely on data depletion to end their training and need to identify the steps_per_epoch or equivalent cessation conditions. epoch in the log is usually an artificial cut of training steps and is not automatically equal to the mere appearance of each original sample.
Five samples [1,2,3,4,5], first batch(2) and retaining the last batch, were obtained [1,2], [3,4], [5], and then repeat, for a total of six batches in two rounds. In the first instance, repeat(2) and batch(2), 10 samples consist of five successive batches, one of which is [5,1]. The calculation of sub-orders changes not only the number of batches, but also the sample within the batch to calculate the statistics together.
If drop_remainder is selected, first batch and then repeat drops the sample 5 per round; The first repeat and then batch may spell it in full with the next sample. These differences are more than just counting details of the tasks of relying on intra-basket regularization, contrasting learning or tailing minorities.
Steps, schedulers and indicators are to be used in the same unit
If the learning rate is planned to move forward on the optimist step and the report is presented as epoch, both should be retained. Each epoch has been changed from 100 to 200 steps, with 10 epoch fixed equal to a doubling of updates and not directly and indirectly referred to as the training budget. Repeated data streams may also cause the same log to appear several times in epoch.
The validation set should normally have a clear limited coverage. If repeat is also unlimited and only fixed steps are taken, the indicator may contain duplicate samples or missing the tail, with the denominator changing with the configuration. The unique number of records and actual processing strips can be recorded at the time of validation, identifying whether double counting is possible. Training allows for duplication of sampling and does not mean that certification should also be treated vaguely.
It is important to identify the data locations from which to proceed when training is resumed. The recovery of the epoch number alone does not guarantee the return of the data transponder to the same sample boundary; To reset strictly, it also involves shuffle status, segmentation and check point strategy. Training can be resumed and re-positioned in general are two different objectives.
The scope of application is TensorFlow 2 tf. data and Keras 3 training loops. A standard list of the series of five samples is available for recovery. When training is exhausted, check the limited number of elements against actual step requirements instead of directly adding repeat to mask the problem.
Value recovery
x=[1,2,3,4,5]batches=lambda a:[a[i:i+2] for i in range(0,len(a),2)]assert len(batches(x)*2) == 6assert batches(x*2) == [[1,2],[3,4],[5,1],[2,3],[4,5]]Five samples first, batch(2), keep the last batch, repeat it twice. How many batches?
Six, two of which had only one sample each. If the batch is repeated twice first, then five full.
Unlimited repeat Set a hundred moves after that. epoch , is it guaranteed to cover all samples?
Can't. Coverage depends on the size of the data, the size of the batch, the sampling and the stop location. The name epoch does not in itself constitute the proof of coverage.
Sources and reconciliations
Definitions, methods and interfaces are available.
- TensorFlow — tf.data: Build TensorFlow input pipelines
- Keras 3 — Writing a training loop from scratch in TensorFlow
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.