Skip to content

Commit

Permalink
test_to_categorical: Ensure that label_smoothing < 0.5 (explosion…
Browse files Browse the repository at this point in the history
…#680)

* `test_to_categorical`: Ensure that `label_smoothing < 0.5`

* Use `exclude_max` instead of clamping to `0.49`
  • Loading branch information
shadeMe authored and adrianeboyd committed Jun 2, 2022
1 parent 6ab4cc6 commit b13840e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion thinc/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def test_array_module_cpu_gpu_helpers():
assert not is_numpy_array((1, 2))


@given(label_smoothing=strategies.floats(min_value=0.0, max_value=0.5))
@given(
label_smoothing=strategies.floats(min_value=0.0, max_value=0.5, exclude_max=True)
)
def test_to_categorical(label_smoothing):
# Test without n_classes
one_hot = to_categorical(numpy.asarray([1, 2], dtype="i"))
Expand Down

0 comments on commit b13840e

Please sign in to comment.