rhymer
Joined 11 years ago
Joined 11 years ago
The focus on commutative diagrams, rather than a free-form canvas, is a brilliant design choice that keeps it clean and easy to use. I wish I'd had this during my thesis; it would have saved so much time.
[0] https://q.uiver.app/#q=WzAsOCxbMCwxLCJnIFxcdGV4dHsgb24gfVxcb...
See "Remarks on some misconceptions about unequal probability sampling without replacement" by Yves Tillé.
Quoted from Tillé's conclusion: "There is a multitude of correct and fast method of sampling... there is no reason to use an incorrect method like weighted random sampling where we do not control the inclusion probabilities"
It's not clear to me how easy it is to implement the "multitude of corect and fast methods" in SQL, though. Would love to see some reference implementation.
One way to simulate "random" arrival time is to draw uniform points in the interval [0, N * tau].
It turns out the inter-arrival time generated this way is approximately exponential:
1. the difference of consecutive ordered uniformly distribution random variables follows a Beta(1, N) distribution [1].
2. As N goes to infinity, N * Beta(1, N) converges to Exponential(1) [2].
3. Since we scale the rand() by N * tau, the inter arrival time will follow an Exponential(1 / tau) distribution (as N goes to infinity), which has an expected value of tau [3].
Edit: I just realized that the author did mention this simulation is only an approximation in the side note.
[1] https://en.wikipedia.org/wiki/Order_statistic#The_joint_dist...
[2] https://en.wikipedia.org/wiki/Beta_distribution#Special_and_...
[3] https://en.wikipedia.org/wiki/Exponential_distribution#Relat...
Two observations: 1. With sufficiently large n, you can control your variance to an acceptable level. 2. The factor f is outside of your control. If your problem has a small density around the median, then you'll need to throw more samples to compensate for it.
I think your concern is about #2: you can always construct a pathological distribution to make the sampling-based approach unattainable. The paper provided guidance on what to expect when you apply the sampling-based approach.
[1] Bahadur, R. R. (1966). A note on quantiles in large samples. Annals of Mathematical Statistics, 37, 577–580.
In my field, understanding signals and systems, probability, optimization, and numerical computing is very important.
Leetcode, in comparison, offers a more confined scope, making preparation more manageable and systematic, ultimately helping me break into software engineering.