compute expectation of a variable

Issue #75 resolved
Samuel Cheng created an issue

Hi,

Lea is a great pedagogic tool and I am trying to use it for my class on information theory and probability. I may have missed that but I couldn’t find it from the tutorial. How can we find the expectation of a random variable?

for example, say for

X = lea.pmf({1:0.5, 2:0.5})

do we have something like

X.expectation

to get 1*0.5 + 2*0.5?

Thanks!

Sam

Comments (5)

  1. Log in to comment