Releases: rethinkpriorities/squigglepy
Releases · rethinkpriorities/squigglepy
v0.8
v0.8
Non-visible backend changes
- Distributions are now implemented as classes (rather than lists).
Bayesian library updates
- [Breaking change]
bayes.update
now updates normal distributions from the distribution rather than from samples. - [Breaking change]
bayes.update
no longer takes atype
parameter but can now infer the type from the passed distribution. - [Breaking change] Corrected a bug in how
bayes.update
implementedevidence_weight
when updating normal distributions.
v0.7
v0.7
Bugfixes
- Fixes an issue with sampling from the
bernoulli
distribution. - Fixes a bug with the implementation of
lclip
andrclip
.
New distributions
- Adds
discrete
to calculate a discrete distribution. Example:discrete({'A': 0.3, 'B': 0.3, 'C': 0.4})
will return A 30% of the time, B 30% of the time, and C 40% of the time. - Adds
poisson(lam)
to calculate a poisson distribution. - Adds
gamma(size, scale)
to calculate a gamma distribution.
Bayesian library updates
- Adds
bayes.bayesnet
to do bayesian inferece (see README). bayes.update
now can take anevidence_weight
parameter. Typically this would be equal to the number of samples.- [Breaking change]
bayes.bayes
has been renamedbayes.simple_bayes
.
Other
- [Breaking change]
credibility
, which defines the size of the interval (e.g.,credibility=0.8
for an 80% CI), is now a property of the distribution rather than the sampler. That is, you should now callsample(norm(1, 3, credibility=0.8))
whereas previously it wassample(norm(1, 3), credibility=0.8)
. This will allow mixing of distributions with different credible ranges. - [Breaking change] Numbers have been changed from functions to global variables. Use
thousand
orK
instead ofthousand()
(old/deprecated). sample
now has a nice progress reporter ifverbose=True
.- The
exponential
distribution now implementslclip
andrclip
. - The
mixture
distribution can infer equal weights if no weights are given. - The
mixture
distribution can infer the last weight if the last weight is not given. geomean
andgeomean_odds
can infer the last weight if the last weight is not given.- You can use
flip_coin
androll_die(sides)
to flip a coin or roll a die. event_happens
andevent
are aliases forevent_occurs
.get_percentiles
will now cast output toint
ifdigits=0
.get_log_percentiles
now has a default value forpercentiles
.- You can now set the seed for the RNG using
sq.set_seed
.
Non-visible backend changes
- Now has tests via pytest.
- The random numbers now come from a numpy generator as opposed to the previous deprecated
np.random
methods. - The
sample
module (containing thesample
function) has been renamedsamplers
.
v0.6
v0.6
New distributions
- Add
triangular(left, mode, right)
to calculate a triangular distribution. - Add
binomial(n, p)
to calculate a binomial distribution. - Add
beta(a, b)
to calculate a beta distribution. - Add
bernoulli(p)
to calculate a bernoulli distribution. - Add
exponential(scale)
to calculate an exponential distribution.
New Bayesian library
- Add
bayes.update
to get a posterior distribution from a prior distribution and an evidence distribution. - Add
bayes.average
to average distributions (via a mixture).
New utility functions
- Add
laplace
to calculate Laplace's Law of Succession. Ifs
andn
are passed, it will calculate(s+1)/(n+2)
. Ifs
,time_passed
, andtime_remaining
are passed, it will use the time invariant version. Usetime_fixed=True
for fixed time periods andtime_fixed=False
(default) otherwise. - Add
geomean
to calculate the geometric mean. - Add
p_to_odds
to convert probability to odds. Alsoodds_to_p
to convert odds to probability. - Add
geomean_odds
to calculate the geometric mean of odds, converted to and from probabilities.
Other
- If a distribution is defined with
sd
but notmean
,mean
will be inferred to be 0. sample
can now takelclip
andrclip
directly, in addition to defininglclip
andrclip
on the distribution itself. If both are defined, the most restrictive of the two bounds will be used.
v0.5
v0.5
- Fix critical bug to
tdist
andlog_tdist
introduced in v0.3.
v0.4
v0.4
- Fix critical bug introduced in v0.3.
v0.3
v0.3
- Be able to define distributions using
mean
andsd
instead of defining the interval.
v0.2
v0.2
- Change
distributed_log
tomixture
(to follow Squiggle) and allow it to implement any sub-distribution. - Changed library to single import.
- Remove
weighted_log
as a distribution.
v0.1
v0.1
- Initial library