-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
31 lines (23 loc) · 807 Bytes
/
plot.py
File metadata and controls
31 lines (23 loc) · 807 Bytes
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
import decimal
import typing
import matplotlib.pyplot as plt
import predictionscorer
predictions: typing.List[predictionscorer.Prediction] = []
for index in range(0, 101):
predictions.append(
predictionscorer.Prediction(
(decimal.Decimal(index), decimal.Decimal(100 - index)),
true_alternative_index=0,
)
)
x_axis_data: typing.List[decimal.Decimal] = []
y_axis_data: typing.List[decimal.Decimal] = []
for prediction in predictions:
x_axis_data.append(prediction.probabilities[0])
y_axis_data.append(prediction.brier_score)
plt.plot(x_axis_data, y_axis_data)
plt.xlabel("Probability")
plt.ylabel("Brier score if true")
plt.title("Brier scores for probabilities 0-100")
plt.draw()
plt.savefig("docs/images/brier-scores-probabilities-0-100.svg")