probula
Members list
Type members
Classlikes
A representation of probabilistic models as multivariate distributions, effectively hierarchical Bayesian models.
A representation of probabilistic models as multivariate distributions, effectively hierarchical Bayesian models.
Attributes
An inclusive range of Double values with a fixed step.
An inclusive range of Double values with a fixed step.
Usage:
Doubles(0.0 -> 1.0) by 0.1
Doubles(0.0, 1.0) points 100
50 doubles (0.0 -> 1.0)
Attributes
- Companion
- object
- Supertypes
-
trait IndexedSeq[Double]trait IndexedSeq[Double]trait Equalstrait IterableOnce[Double]class Objecttrait Matchableclass AnyShow all
Representation of Inference Data. The intention is to make it compatible with the inference data in the Python world (one day...)
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Witness that all components of T can be decomposed into Doubles. Works for bare numeric scalars (via Numeric) and tuples of numerics (recursively).
Witness that all components of T can be decomposed into Doubles. Works for bare numeric scalars (via Numeric) and tuples of numerics (recursively).
Attributes
- Companion
- object
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
- Self type
-
NumericDecomposition.type
The Probula object is used as an entry point to the framework. One starts building a probula probabilistic model by using factory methods from this object. Once the model is initiated (the first variable is created), one can use the model methods (@see probula.Dist) to add more new variables, hierarchical dependencies, and observations.
The Probula object is used as an entry point to the framework. One starts building a probula probabilistic model by using factory methods from this object. Once the model is initiated (the first variable is created), one can use the model methods (@see probula.Dist) to add more new variables, hierarchical dependencies, and observations.
Attributes
- Supertypes
- Self type
-
Probula.type
Value members
Concrete fields
Givens
Givens
Extensions
Extensions
Export inference data as a CSV string. Columns: sample, one per variable, log_weight. Variable names are derived from this IData's Name.
Export inference data as a CSV string. Columns: sample, one per variable, log_weight. Variable names are derived from this IData's Name.
Attributes
Same as mean.
Same as mean.
Attributes
Compute a mean for a numeric sample. A numerically stable way to compute this, similar to LogSumExp, but exploiting that max cancels out in the numerator and denominator.
Compute a mean for a numeric sample. A numerically stable way to compute this, similar to LogSumExp, but exploiting that max cancels out in the numerator and denominator.
Attributes
Compute a median of a sample with a defined Ordering.
Compute a median of a sample with a defined Ordering.
For simplicity we drop one element if the sample is of even length. Typically to be used on a univariate sample of numbers (then the ordering exists).
It requires that the chain is finite! Otherwise it will crash.
Attributes
Compute a weighted percentile for a numeric sample. Returns the value below which fraction q of the weighted mass falls. Linearly interpolates between the two bracketing values when the threshold falls between samples.
Compute a weighted percentile for a numeric sample. Returns the value below which fraction q of the weighted mass falls. Linearly interpolates between the two bracketing values when the threshold falls between samples.
Uses the same weighted cumulative mass approach as median, generalized to an arbitrary threshold.
Value parameters
- q
-
the quantile in [0, 1] (e.g. 0.5 for the median, 0.055 for the 5.5th percentile)
Attributes
Compute the standard deviation for a numeric sample. This is the square root of the variance.
Compute the standard deviation for a numeric sample. This is the square root of the variance.
Attributes
Compute a sample variance for a numeric sample. Uses the unbiased weighted estimator (a generalization of Bessel's correction for weighted samples, for example see reliability weights in https://en.wikipedia.org/wiki/Weighted_arithmetic_mean #Related_concepts): Var = sum wi(xi - mu)^2 * V1 / (V1^2 - V2) where V1 = sum wi, V2 = sum wi^2. For uniform weights this reduces to sum(xi - mu)^2/(n-1). Uses the max-subtraction trick (as in mean) for numerical stability when log-scores are very negative.
Compute a sample variance for a numeric sample. Uses the unbiased weighted estimator (a generalization of Bessel's correction for weighted samples, for example see reliability weights in https://en.wikipedia.org/wiki/Weighted_arithmetic_mean #Related_concepts): Var = sum wi(xi - mu)^2 * V1 / (V1^2 - V2) where V1 = sum wi, V2 = sum wi^2. For uniform weights this reduces to sum(xi - mu)^2/(n-1). Uses the max-subtraction trick (as in mean) for numerical stability when log-scores are very negative.
Attributes
This scored sample adjusted with a new score (logScores are added, scores are multiplied)
This scored sample adjusted with a new score (logScores are added, scores are multiplied)
Attributes
extract a value-score pair from a scored value
extract a value-score pair from a scored value
Attributes
Rescore the chain by adding the log score returned by f to the log score of each sample. Corresponds to multiplying/scaling in the linear space.
Rescore the chain by adding the log score returned by f to the log score of each sample. Corresponds to multiplying/scaling in the linear space.
Attributes
Reduce the chain by combining the scores of the same values. The values are grouped by their value, and the scores are summed using logSumExp.
Reduce the chain by combining the scores of the same values. The values are grouped by their value, and the scores are summed using logSumExp.
Attributes
Returns the sample size. Note that this may be wrong if the chain has been reduced by Value (This is easy to fix by storing the size in the Chain object; one day, if we see that it matters)
Returns the sample size. Note that this may be wrong if the chain has been reduced by Value (This is easy to fix by storing the size in the Chain object; one day, if we see that it matters)
Attributes
Same as mean.
Same as mean.
Attributes
Delegator to Chain.percentile.
Delegator to Chain.percentile.
Attributes
Delegator to Chain.stdDev.
Delegator to Chain.stdDev.
Attributes
A summary table of the posterior, showing mean, standard deviation, the 89% percentile interval (5.5% to 94.5%), and a sparkline histogram for each variable. Inspired by McElreath's precis.
A summary table of the posterior, showing mean, standard deviation, the 89% percentile interval (5.5% to 94.5%), and a sparkline histogram for each variable. Inspired by McElreath's precis.
Value parameters
- histogram
-
whether to include a sparkline histogram column (default: true)