I am pretty familiar with using reservoir sampling to sample from a set of indefinite length in one pass from the data. One of the limitations of this approach, in my opinion, is that it still requires going through the entire data set before any results can be returned. Conceptually, this makes sense, since it is necessary to allow elements in the entire sequence to replace previously discovered elements to achieve a single pattern.
Is there a way to give some random results before evaluating the entire sequence? I am thinking of a lazy approach that would work well with the large itertools python library. Perhaps this could be done within the framework of a certain error? I would appreciate any feedback on this idea!
To clarify this question a bit, this diagram summarizes my understanding of the trade-offs in memory and streaming of various sampling methods. I want something that falls into the Sample Stream category, where we do not know the length of the population in advance.

It is clear that there seems to be a contradiction in that he does not know the length a priori and is still getting a single sample, since we will most likely shift the sample to the beginning of the population. Is there a way to quantify this bias? Are there any compromises? Does anyone have a smart algorithm to solve this problem?
python algorithm random-sample
Stankalank
source share