Statistical methods in NLP Random variables in Scipy

Statistical methods in NLP

Random variables in Scipy

UNIVERSITY OF

GOTHENBURG

Richard Johansson

January 26, 2016

overview

recap: random variables

random variables in Scipy

the cumulative distribution function

UNIVERSITY OF

GOTHENBURG

random variables and their distributions

I a

random variable (r.v.)

randomly, like

is a variable that selects its value

random.randint

and

random.random

X , we use a function

called the probability mass function (pmf ) of X :

I to describe the distribution of the r.v.

pX (x ) = P (X

x)

takes the value

I for instance, the number of heads when tossing a coin twice:

pX (0) = P (X = 0) =

pX (1) = P (X = 1) = 24

pX (2) = P (X = 2) = 14

1

4

UNIVERSITY OF

GOTHENBURG

1.0

0.8

0.6

0.4

0.2

0.0

0

1

2

the mean value of a random variable

I the notion of

variables:

mean has a natural correspondence for random

I intuitively, this corresponds to what happens if we take the

mean of a very large sample from the random variable

X) =

E(

I similarly, we have the

X

i

variance:

pX (i ) ¡¤ i

if E(

X ) = m, then

V (X ) = E[(X ? m)2 ]

I and naturally, there is also a

standard deviation

D (X ) = V (X )

p

UNIVERSITY OF

GOTHENBURG

the Bernoulli distribution

X = 1) with the

p and tails (X = 0) with probability 1 ? p:

I we toss an uneven coin that gives heads (

probability

1.0

pX (0) = 1 ? p

pX (1) = p

0.8

0.6

0.4

0.2

0.0

I

X

is then said to have a

parameter

p

0

Bernoulli distribution with a

I a single experiment that can succeed or not

UNIVERSITY OF

GOTHENBURG

1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download