mxnet.gluon.probability.distributions.categorical¶
Categorical class.
Classes
|
Create a categorical distribution object. |
- class mxnet.gluon.probability.distributions.categorical.Categorical(num_events, prob=None, logit=None, validate_args=None)[source]¶
Bases:
DistributionCreate a categorical distribution object.
- Parameters:
num_events (Int) – Number of events.
prob (Tensor) – Probabilities of each event.
logit (Tensor) – The log-odds of each event
- broadcast_to(batch_shape)[source]¶
Returns a new distribution instance with parameters expanded to batch_shape. This method calls numpy.broadcast_to on the parameters.
- Parameters:
batch_shape (Tuple) – The batch shape of the desired distribution.
- enumerate_support()[source]¶
Returns a tensor that contains all values supported by a discrete distribution.
- log_prob(value)[source]¶
Compute the log-likelihood of value
- Parameters:
value (Tensor) – samples from Categorical distribution
- Returns:
log-likelihood of value
- Return type:
Tensor
- logit()[source]¶
Get the log probability of sampling each class.
- Returns:
Parameter tensor.
- Return type:
Tensor
- prob()[source]¶
Get the probability of sampling each class.
- Returns:
Parameter tensor.
- Return type:
Tensor
- sample(size=None)[source]¶
Sample from categorical distribution. Given logit/prob of size (batch_size, num_events), batch_size samples will be drawn. If size is given, np.broadcast(size, batch_size) samples will be drawn.
- property support¶
Returns a function representing the distribution’s support.