-
-
Save keunwoochoi/0184744dd72782d4f94db73c6a9b4c94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
import pescador | |
def data_sampler(filename, n_samples): | |
# Load all the data from the file, somehow | |
data = load_data(filename) | |
for n in range(n_samples): | |
x, y = sample(data) | |
yield dict(x=x, y=y) | |
stream = pescador.Streamer(data_sampler, n_samples=128) | |
streamer = pescador.zmq_stream(stream) | |
for sample in steamer: | |
process(sample) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment