pymc.StickBreakingWeights#

class pymc.StickBreakingWeights(name, *args, rng=None, dims=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs)[source]#

Likelihood of truncated stick-breaking weights. The weights are generated from a stick-breaking proceduce where \(x_k = v_k \prod_{\ell < k} (1 - v_\ell)\) for \(k \in \{1, \ldots, K\}\) and \(x_K = \prod_{\ell = 1}^{K} (1 - v_\ell) = 1 - \sum_{\ell=1}^K x_\ell\) with \(v_k \stackrel{\text{i.i.d.}}{\sim} \text{Beta}(1, \alpha)\).

Support

\(x_k \in (0, 1)\) for \(k \in \{1, \ldots, K+1\}\) such that \(\sum x_k = 1\)

Mean

\(\mathbb{E}[x_k] = \dfrac{1}{1 + \alpha}\left(\dfrac{\alpha}{1 + \alpha}\right)^{k - 1}\) for \(k \in \{1, \ldots, K\}\) and \(\mathbb{E}[x_{K+1}] = \left(\dfrac{\alpha}{1 + \alpha}\right)^{K}\)

Parameters
alphatensor_like of float

Concentration parameter (alpha > 0).

Ktensor_like of int

The number of “sticks” to break off from an initial one-unit stick. The length of the weight vector is K + 1, where the last weight is one minus the sum of all the first sticks.

References

1

Ishwaran, H., & James, L. F. (2001). Gibbs sampling methods for stick-breaking priors. Journal of the American Statistical Association, 96(453), 161-173.

2

Müller, P., Quintana, F. A., Jara, A., & Hanson, T. (2015). Bayesian nonparametric data analysis. New York: Springer.

Methods

StickBreakingWeights.__init__(*args, **kwargs)

StickBreakingWeights.dist(alpha, K, *args, ...)

Creates a tensor variable corresponding to the cls distribution.

StickBreakingWeights.logp(alpha, K)

Calculate log-probability of the distribution induced from the stick-breaking process at specified value.

StickBreakingWeights.moment(size, alpha, K)

Attributes

rv_class

rv_op