Add more flexible sampler types through Range
#2758
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes: This proposes a new type of samplers, that select (not necessarily) random instances to construct training or validation batches. The main addition to the existing samplers, is that we can configure sampling ranges with timestamps (
pd.Period
) in addition to integer indices: this is obtained through theRange
class.This should allow composing batches as required in this discussion. In addition, it improves the code compared to existing samplers, I believe.
In summary,
Range
represents a "partially specified"range
object, that can only be constructed once we know what sequence we intend to range over (where in time it starts, and how log it is). Once the sequence is known, a regular Pythonrange
object is constructed, and samplers take (not necessarily) random elements from it according to their own strategy.Examples:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup