示例#1
0
 def test_wilson_valid(self):
     error = 0.2
     n_samples = 300
     assert pytest.approx(wilson_score_interval(error, n_samples, 90),
                          1e-3) == 0.03787
     assert pytest.approx(wilson_score_interval(error, n_samples, 95),
                          1e-3) == 0.04526
     assert pytest.approx(wilson_score_interval(error, n_samples, 98),
                          1e-3) == 0.05381
     assert pytest.approx(wilson_score_interval(error, n_samples, 99),
                          1e-3) == 0.05958
示例#2
0
 def test_wilson_invalid_samples(self):
     with pytest.raises(InvalidArgumentError):
         wilson_score_interval(0.2, -9, 90)
示例#3
0
 def test_wilson_invalid_confidence(self):
     with pytest.raises(InvalidArgumentError):
         wilson_score_interval(0.2, 100, 92)
示例#4
0
 def test_wilson_invalid_error(self):
     with pytest.raises(InvalidArgumentError):
         wilson_score_interval(-0.01, 300, 90)
     with pytest.raises(InvalidArgumentError):
         wilson_score_interval(1.01, 300, 90)