Skip to content

Commit

Permalink
add relevant documentation for generating random values from ensemble…
Browse files Browse the repository at this point in the history
… distribution
  • Loading branch information
mbi6245 committed Aug 13, 2024
1 parent 825f375 commit 3168b18
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions simulations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
"from ensemble.distributions import distribution_dict\n",
"from ensemble.ensemble_model import EnsembleFitter\n",
"\n",
"# reference: https://github.com/scipy/scipy/blob/v1.14.0/scipy/stats/_distn_infrastructure.py#L994\n",
"# relevant lines: 1026, 1048, 1938, 1941\n",
"# summary:\n",
"# create ensemble cdf with at least 2 distributions/corresponding weights with shared mean and variance\n",
"# draw sample from Unif(0, 1)\n",
"# give sample to vectorized ppf_single\n",
"# optimize (using Brent's method) with objective function ensemble_cdf(x) - q, where q is your Unif(0, 1) sample\n",
"# return quantiles which minimize the objective function (i.e. which values of x minimize ensemble_cdf(x) - q)\n",
"\n",
"def ensemble_cdf(x, distributions, weights, mean, variance):\n",
" my_objs = []\n",
" for distribution in distributions:\n",
Expand Down

0 comments on commit 3168b18

Please sign in to comment.