Get all informations of a discrete random variable in tensorflow

49 views Asked by At

Imagine that I build a discrete random variable in tensorflow. There is a way to get the P(X = k) and associated probabilities ? i.e two lists [k_1 .., k_n] and [p_1,.., p_n] with p_i = P(X = k_i) ?

1

There are 1 answers

2
Brian Patton On

How about tfp.distributions.Categorical(logits=np.random.randn(10)).probs_parameter()

And if you wanted it to take on values different from 0..9, you could use tfp.distributions.FiniteDiscrete