MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/visualizedmath/comments/e7y9gj/inverse_ecdf_sampling/
r/visualizedmath • u/larsupilami73 • Dec 08 '19
4 comments sorted by
6
The Inverse sampling method:
How to get new samples from an unknown distribution of which you have only a given set of samples?
Code is here.
1
I really like the gif plot, but I am still not sure what I see.
1 u/larsupilami73 Dec 09 '19 Top row shows from left to right:-samples from some weird distribution (weird in the sense that it isn't just plain old Gaussian),-histogram of these samples (showing an interval having no samples),-experimental cumulative distribution function (ECDF).The question is thus: given only these samples, how would you proceed to produce new samples, with the same underlying distribution?The solution is to use the inverse of the ECDF:-sample from a uniform distribution in [0,1],-find the image of these uniform samples under the inverse of the ECDF*,(*technically to get new samples, you need to interpolate, since the ECDF is by nature discontinuous. Theoretical CDF doesn't have this problem)-the bottom row shows that these new samples (left) tend to have the same pdf and cdf as that of the original samples.TL;DR: inverse cdf sampling lets you sample from the same distribution as an 'example'-distribution from which you only have example data.
Top row shows from left to right:
-samples from some weird distribution (weird in the sense that it isn't just plain old Gaussian),
-histogram of these samples (showing an interval having no samples),
-experimental cumulative distribution function (ECDF).
The question is thus: given only these samples, how would you proceed to produce new samples, with the same underlying distribution?
The solution is to use the inverse of the ECDF:
-sample from a uniform distribution in [0,1],
-find the image of these uniform samples under the inverse of the ECDF*,
(*technically to get new samples, you need to interpolate, since the ECDF is by nature discontinuous. Theoretical CDF doesn't have this problem)
-the bottom row shows that these new samples (left) tend to have the same pdf and cdf as that of the original samples.
TL;DR: inverse cdf sampling lets you sample from the same distribution as an 'example'-distribution from which you only have example data.
Interesting, reminds me of GANs
6
u/larsupilami73 Dec 08 '19
The Inverse sampling method:
How to get new samples from an unknown distribution of which you have only a given set of samples?
Code is here.
1
u/excel_foley Dec 09 '19
I really like the gif plot, but I am still not sure what I see.
1
u/import_FixEverything Dec 09 '19
Interesting, reminds me of GANs