probly.representation.distribution.array_dirichlet¶
Numpy-based distribution representation.
Classes
|
A Dirichlet distribution stored as a numpy array. |
- class probly.representation.distribution.array_dirichlet.ArrayDirichlet(alphas=<property object>)[source]¶
Bases:
DirichletDistribution,NDArrayOperatorsMixinA Dirichlet distribution stored as a numpy array.
Shape: (…, num_classes) The last axis represents the category dimension.
- Parameters:
alphas (ndarray)
- classmethod from_array(alphas, dtype=None)[source]¶
Create a Dirichlet distribution from an array or list.
- Parameters:
alphas (np.ndarray | list)
dtype (DTypeLike)
- Return type:
Self
- sample(num_samples=1, rng=None)[source]¶
Sample from the Dirichlet distribution (NumPy backend).
- Parameters:
- Return type:
- property dtype: DTypeLike¶
The data type of the underlying array.