Motif finding, part II
CSE 180
Yana Safonova
Back to profile matrix
P(T) = ½
P(T) = ½
P(at least one T after 3 flippings) = ½ + ½ + ½ = 1.5 > 1
What did we do wrong?
P(T) = ½
P(at least one T after 3 flippings) ! = ½ + ½ + ½ = 1.5 > 1
P(T) = ½
P(at least one T after 3 flippings) ! = ½ + ½ + ½ = 1.5 > 1
P(T) = ½
P(at least one T after 3 flippings) ! = ½ + ½ + ½ = 1.5 > 1
P(T) = ½
P(at least one T after 3 flippings) ! = ½ + ½ + ½ = 1.5 > 1
Random variables
What are Ω and S here?
S
Samples of random variables
Question: what are Ω and S in each of these cases?
Rolling a die...
Histogram for 1000 trials
Histograms in everyday life
Histograms in everyday life
Histograms in everyday life
Uniform distribution
Uniform distribution
Uniform distribution
2 = 1 + 1
3 = 1 + 2 = 2 + 1
4 = 1 + 3 = 2 + 2 = 3 + 1
…
7 = 1 + 6 = 2 + 5 = 3 + 4 = 4 + 3 = 5 + 2 = 6 + 1
…
12 = 6 + 6
Random numbers
R1 = seed, R2 = f(R1), R3 = f(R2), ...
Random numbers
R1 = seed, R2 = f(R1), R3 = f(R2), ...
Random package
import random
random.randint(1, 1000)
>979
import random
random.seed(1)
random.randint(1, 1000)
>135
import random
random.randint(1, 1000)
>375
import random
random.seed(1)
random.randint(1, 1000)
>135
Not all distributions are uniform
2 = 1 + 1
3 = 1 + 2 = 2 + 1
4 = 1 + 3 = 2 + 2 = 3 + 1
…
7 = 1 + 6 = 2 + 5 = 3 + 4 = 4 + 3 = 5 + 2 = 6 + 1
…
11 = 5 + 6 = 6 + 5
12 = 6 + 6
Not all distributions are uniform
Gaussian distribution
Visualization of samples
import matplotlib as mplt
import matplotlib.pyplot as plt
import random
x = []
n = 10000
for i in range(n):
x.append(random.gauss(1, 10))
plt.hist(x, bins = 100)
plt.xlabel(‘X’)
plt.ylabel(‘# outcomes’)
plt.savefig(“my_hist.png”)
Visualization of samples
Visualization of samples
n_1_100 = []
n_1_50 = []
n_1_10 = []
for i in range(n):
n_1_100.append(random.gauss(1, 100))
n_1_50.append(random.gauss(1, 50))
n_1_10.append(random.gauss(1, 10))
plt.hist([n_1_100, n_1_50, n_1_10], bins = 100, label = ['mu = 1, sigma = 100', 'mu = 1, sigma = 50', 'mu = 1, sigma = 10'])
plt.legend()
plt.savefig(“my_hist.png”)
Visualization of samples
Helpful links
How to measure significance of a motif
Examples:
Practice