-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
71 lines (53 loc) · 1.71 KB
/
plot.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
from decimal import Decimal
from typing import List
from matplotlib import pyplot as plt
from predictionscorer.rules import (
brier_score,
logarithmic_score,
practical_score,
quadratic_score,
)
probabilities: List[float] = []
x_axis_data: List[int] = []
for index in range(1, 100):
probabilities.append((index / 100))
x_axis_data.append(index)
y_axis_data: List[Decimal] = []
for probability in probabilities:
y_axis_data.append(brier_score(probability))
plt.plot(x_axis_data, y_axis_data)
plt.xlabel("Probability assigned to correct answer")
plt.ylabel("Brier score")
plt.title("Brier score for probabilities 1 % - 99 %")
plt.draw()
plt.savefig("docs/charts/brier.svg")
plt.clf()
y_axis_data = []
for probability in probabilities:
y_axis_data.append(logarithmic_score(probability))
plt.plot(x_axis_data, y_axis_data)
plt.xlabel("Probability assigned to correct answer")
plt.ylabel("Logarithmic score")
plt.title("Logarithmic score for probabilities 1 % - 99 %")
plt.draw()
plt.savefig("docs/charts/logarithmic.svg")
plt.clf()
y_axis_data = []
for probability in probabilities:
y_axis_data.append(practical_score(probability))
plt.plot(x_axis_data, y_axis_data)
plt.xlabel("Probability assigned to correct answer")
plt.ylabel("Practical score")
plt.title("Practical score for probabilities 1 % - 99 %")
plt.draw()
plt.savefig("docs/charts/practical.svg")
plt.clf()
y_axis_data = []
for probability in probabilities:
y_axis_data.append(quadratic_score(probability))
plt.plot(x_axis_data, y_axis_data)
plt.xlabel("Probability assigned to correct answer")
plt.ylabel("Quadratic score")
plt.title("Quadratic score for probabilities 1 % - 99 %")
plt.draw()
plt.savefig("docs/charts/quadratic.svg")