ihmeuw / risk_distributions

BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

Initial stab at modifying the EnsembleDistribution class. Instead of … #31

Closed KjellSwedin closed 3 years ago

KjellSwedin commented 3 years ago

…weighting the sampled result of a distribution, we use the weighting to pick a distribution from which to sample.

Here is an example comparing the results from the current code (on top) and the new code (on bottom). As with the LSFF code, the mean remains similar but the tails get longer.

In [49]: pd.Series(ppf).describe()
Out[49]: 
count    1000.000000
mean       28.778341
std        21.952865
min        -0.729606
25%        10.471523
50%        24.585799
75%        43.283797
max       109.786157
dtype: float64

In [50]: pd.Series(ppfA).describe()
Out[50]: 
count    1000.000000
mean       28.577141
std        22.632246
min        -2.437593
25%        10.733608
50%        25.078260
75%        42.765163
max       228.270264
dtype: float64

Known issues: this isn't tied into the Common Random Number system in the framework. I like the use of np.random.choice() -- it seems fairly intuitive. What could be done to make it play nicely with the rest of the framework?