pangolin.interface.Interface.categorical

pangolin.interface.Interface.categorical#

Interface.categorical(theta)[source]#

Create a scalar categorical RV (Wikipedia).

theta must be a one-dimensional vector of nonnegative probabilities that sum to one. The IR validates its shape; the probability constraints remain backend-level. The result is a scalar category index.

Parameters:

theta (RVLike) – Category probabilities.

Return type:

RV

Examples

>>> import pangolin.interface as pi
>>> pi.categorical([0.2, 0.3, 0.5]).shape
()