Exemple #1
0
    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))
 def test_100_percent(self):
     assert brier_score(1) == 0
 def test_80_percent(self):
     assert brier_score(0.80) == Decimal("0.08")
 def test_50_percent(self):
     assert brier_score(0.50) == 0.5
 def test_20_percent(self):
     assert brier_score(0.20) == Decimal("1.28")
 def test_0_percent(self):
     assert brier_score(0.0) == 2