-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgrapher.py
More file actions
121 lines (80 loc) · 2.9 KB
/
grapher.py
File metadata and controls
121 lines (80 loc) · 2.9 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
folderToSave = "output_confidence_graphs"
def plotCalculatedAverages():
filename = "calculated_output_averages.txt"
with open(filename) as f:
lines = f.read().splitlines()
x = [float(i) for i in lines[2:]]
mu, sigma = 100, 15
# the histogram of the data
n, bins, patches = plt.hist(x, 500)
# add a 'best fit' line
y = mlab.normpdf( bins, mu, sigma)
l = plt.plot(bins, y, 'r--', linewidth=1)
plt.axis([0, 1, 0, 150])
plt.grid(True)
plt.xlabel('average confidence per video')
plt.ylabel('Number of occurances')
plt.title('Calculated Algorithm: Histogram of Average Confidence/video \n vs Number of Occurances (out of 10,000)')
plt.savefig(folderToSave+"/calculated_output_averages.png")
plt.show()
def plotCalculatedDiff():
filename = "calculated_output_diff.txt"
with open(filename) as f:
lines = f.read().splitlines()
x = [float(i) for i in lines[2:]]
mu, sigma = 100, 15
# the histogram of the data
n, bins, patches = plt.hist(x, 500)
# add a 'best fit' line
y = mlab.normpdf( bins, mu, sigma)
l = plt.plot(bins, y, 'r--', linewidth=1)
plt.axis([0, 1, 0, 150])
plt.grid(True)
plt.xlabel('Difference in (avg_student_conf - avg_video_conf) per video')
plt.ylabel('Number of occurances')
plt.title('Calculated Algorithm: Histogram of Confidence Difference/video \n vs Number of Occurances (out of 10,000)')
plt.savefig(folderToSave+"/calculated_output_diff.png")
plt.show()
def plotRandomAverages():
filename = "random_output_averages.txt"
with open(filename) as f:
lines = f.read().splitlines()
x = [float(i) for i in lines[2:]]
mu, sigma = 100, 15
# the histogram of the data
n, bins, patches = plt.hist(x, 500)
# add a 'best fit' line
y = mlab.normpdf( bins, mu, sigma)
l = plt.plot(bins, y, 'r--', linewidth=1)
plt.axis([0, 1, 0, 150])
plt.grid(True)
plt.xlabel('average confidence per video')
plt.ylabel('Number of occurances')
plt.title('Random Algorithm: Histogram of Average Confidence/video \n vs Number of Occurances (out of 10,000)')
plt.savefig(folderToSave+"/random_output_averages.png")
plt.show()
def plotRandomDiff():
filename = "random_output_diff.txt"
with open(filename) as f:
lines = f.read().splitlines()
x = [float(i) for i in lines[2:]]
mu, sigma = 100, 15
# the histogram of the data
n, bins, patches = plt.hist(x, 500)
# add a 'best fit' line
y = mlab.normpdf( bins, mu, sigma)
l = plt.plot(bins, y, 'r--', linewidth=1)
plt.axis([0, 1, 0, 150])
plt.grid(True)
plt.xlabel('Difference in (avg_student_conf - avg_video_conf) per video')
plt.ylabel('Number of occurances')
plt.title('Random Algorithm: Histogram of Confidence Difference/video \n vs Number of Occurances (out of 10,000)')
plt.savefig(folderToSave+"/random_output_diff.png")
plt.show()
plotRandomDiff()
plotRandomAverages()
plotCalculatedDiff()
plotCalculatedAverages()