-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_test.py
executable file
·71 lines (49 loc) · 1.34 KB
/
run_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
import math
from blb import *
def mean(sample):
return sum(sample)*1.0/len(sample)
def stddev(sample):
mn = mean(sample)
return math.sqrt(sum([(x-mn)*(x-mn) for x in sample])*1.0/(len(sample)-1))
class MeanMean_BLB(BLB):
def compute_estimate(self, sample):
return mean(sample)
def reduce_bootstraps(self, sample):
return mean(sample)
def average(self, sample):
return mean(sample)
class SDMean_BLB(BLB):
def compute_estimate(self, sample):
return mean(sample)
def reduce_bootstraps(self, sample):
return stddev(sample)
def average(self, sample):
return mean(sample)
class MeanSD_BLB(BLB):
def compute_estimate(self, sample):
return stddev(sample)
def reduce_bootstraps(self, sample):
return mean(sample)
def average(self, sample):
return mean(sample)
class SDSD_BLB(BLB):
def compute_estimate(self, sample):
return stddev(sample)
def reduce_bootstraps(self, sample):
return stddev(sample)
def average(self, sample):
return mean(sample)
data = range(10000)
blb = MeanMean_BLB()
result = blb.run(data)
print ("Mean of Mean: ", result)
blb = SDMean_BLB()
result = blb.run(data)
print ("SD of Mean: ", result)
blb = MeanSD_BLB()
result = blb.run(data)
print ("Mean of SD: ", result)
blb = SDSD_BLB()
result = blb.run(data)
print ("SD of SD: ", result)