Exemple #1
0
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))
 def test_100_percent(self):
     assert logarithmic_score(1) == 0
 def test_80_percent(self):
     assert logarithmic_score(0.80) == approximately(0.321)
 def test_50_percent(self):
     assert logarithmic_score(0.50) == 1
 def test_20_percent(self):
     assert logarithmic_score(0.20) == approximately(2.321)
 def test_0_percent(self):
     with pytest.raises(AssertionError):
         assert logarithmic_score(0.0)