def test_least_confident_notarray(): probs = [0.5, 0.5] with pytest.raises(ValueError) as excinfo: least_confident(probs) assert 'Probs should be a numpy array' in str(excinfo.value)
def test_least_confident_fourclass(): probs = np.array([0.1, 0.1, 0.1, 0.7]) lc = least_confident(probs) np.testing.assert_almost_equal(lc, 0.3)
def test_least_confident_binary(): probs = np.array([0.2, 0.8]) lc = least_confident(probs) np.testing.assert_almost_equal(lc, 0.2)
def test_least_confident_threeclass(): probs = np.array([0.1, 0.3, 0.6]) lc = least_confident(probs) np.testing.assert_almost_equal(lc, 0.4)