Live data from Hacker News

Reservoir Sampling

samwho.dev

101–107 of 107 posts

Re: Reservoir Sampling

#101
post #21

Earlier quoted context omitted.

https://en.wikipedia.org/wiki/German_tank_problem

An interesting corollary of this is that if you only have a single sample, it reduces to indicating that your sample is the median value - i.e. if you see one item with serial number N, you can guess that there were roughly 2N produced.

You do have outliers though. Seal Team 6 is actually Seal Team 1 but they wanted people to think they were outnumbered.

Re: Reservoir Sampling

#102
post #95

Earlier quoted context omitted.

Fairly sure the previous poster is describing statistics that were made up, rather than measured/sampled. Those are, for hopefully obvious reasons, not very trustworthy

so, the actual lesson to be learned was more along the lines of "never trust lies".

Sure, but in this case the lies ended up packaged as the official tourism statistics report from the government, and I'm pretty sure it was neither the first nor last time that happened.

Re: Reservoir Sampling

#103
post #56

Earlier quoted context omitted.

I have a few more topics we could cooperate on, if you are interested. https://claude.ai/public/artifacts/62d0d742-3316-421b-9a7b-d... has a 'very static' visualisation of sorting algorithms. Basically, we have a 2d plane, and we colour a pixel (x, y) black iff the sorting algorithm compares x with y when it runs. It's a resurrection (with AI) of an older project I was coding up manually at https://github.com/matthia…

I made a tool to visualize sorting algos https://xosh.org/VisualizingSorts/sorting.html where you can put your own algo too if you like.

I love the idea behind that sorting visualization, and found it extremely useful to validate the properties of my Quicksort implementation.

https://github.com/ncruces/sort

Re: Reservoir Sampling

#104
post #49

Earlier quoted context omitted.

Though I think it's only strictly true, if the intervals you sample over are the same. Eg they both sample some messages every second, and the all start their second-long intervals on the same nanosecond (or close enough). I find it easier to reason about reservoir sampling in an alternative formulation: the article talks about flipping a random (biased) coin for each arrival. Instead we can re-interpret reservoir sa…

I would expect any way to get a truly fair sample from a truly fair sample would necessarily result in a truly fair sample. I can't imagine how it could possibly not.

I always find the interaction between probability distributions a little surprising.

Re: Reservoir Sampling

#105
post #49

Earlier quoted context omitted.

Though I think it's only strictly true, if the intervals you sample over are the same. Eg they both sample some messages every second, and the all start their second-long intervals on the same nanosecond (or close enough). I find it easier to reason about reservoir sampling in an alternative formulation: the article talks about flipping a random (biased) coin for each arrival. Instead we can re-interpret reservoir sa…

I would expect any way to get a truly fair sample from a truly fair sample would necessarily result in a truly fair sample. I can't imagine how it could possibly not.

You are dropping a lot of context here.

In the first instance, every second we get a 'truly fair' random sample from all the messages in that second.

Going from there to eg a 'truly fair' random sample from all the messages in a minute is not trivial. And it's not even possible just from the samples, without auxiliary information.

Re: Reservoir Sampling

#106
post #56

Earlier quoted context omitted.

I have a few more topics we could cooperate on, if you are interested. https://claude.ai/public/artifacts/62d0d742-3316-421b-9a7b-d... has a 'very static' visualisation of sorting algorithms. Basically, we have a 2d plane, and we colour a pixel (x, y) black iff the sorting algorithm compares x with y when it runs. It's a resurrection (with AI) of an older project I was coding up manually at https://github.com/matthia…

I made a tool to visualize sorting algos https://xosh.org/VisualizingSorts/sorting.html where you can put your own algo too if you like.

That's interesting. Alas, it only works for in-place sorting algorithms (and it's also an animation).

Re: Reservoir Sampling

#107
post #58

Earlier quoted context omitted.

Never trust statistics. I once worked on a reservation system for some pretty big ski resorts. We were running late, working nights, and one of the last things we had to finish was the official statistics reports about number of guest nights etc that gets published by the government. Lets just say that the statistics that year had little to do with reality.

You’re confusing statistics with forecasting. We can and should trust statistics. We should just never trust their relation to future behavior.

>We can and should trust statistics. We should just never trust their relation to future behavior.

99% of people I've ever met believe statistics and forecasting are synonyms.

Mostly because it gets used that way in a political sense.

Post reply on HN