Question: Use only Python to write the code 3. Entropy of a discrete RV: Recall the definition of entropy of a discrete RV X from class,

Use only Python to write the code
3. Entropy of a discrete RV: Recall the definition of entropy of a discrete RV X from class, H(X) = - E p(x) log p(x), where p(x) is the probability mass function (PMF) of X, and X is the set of possible values that the random variable X can take. (a) Write a function that accepts a PMF as input and outputs the entropy in bits. Do check for the condition of a value being assigned zero probability. (3) (b) Now use the above function to plot the entropy of X ~ Bern(p) as a function of p. Where does p this plot attain its maximum? (2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
