def test_f1_max_raw() -> None:
    """Checks if F1Max metric computes the optimal F1 score.

    Test when the preds are outside [0, 1]. BinaryPrecisionRecall automatically applies sigmoid.
    """
    metric = F1Max()

    preds = torch.tensor([-0.5, 0, 0.5, 1.0, 2])
    labels = torch.tensor([0, 1, 1, 1, 1])

    metric.update(preds, labels)
    assert metric.compute() == 1.0
    assert metric.threshold == 0.0

    metric.reset()
    preds = torch.tensor([-0.5, 0.0, 1.0, 2.0, -0.1])
    metric.update(preds, labels)
    assert metric.compute() == torch.tensor(1.0)
    assert metric.threshold == -0.1
Checks if F1Max metric computes the optimal F1 score.

    Test when the preds are outside [0, 1]. BinaryPrecisionRecall automatically applies sigmoid.
    
tests/unit/metrics/test_f1_max.py