Skip to content

Commit

Permalink
Adjust margin of logistic regression log_proba pytest to avoid fals…
Browse files Browse the repository at this point in the history
…e positive failures (#6188)

Not infrequently in CI we see errors in the comparison of Logistic Regression's `log_proba` arrays when compared to sklearn while the probabilities are within margin, this PR adjusts the margin to avoid that false positive failure.

Authors:
  - Dante Gama Dessavre (https://github.com/dantegd)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #6188
  • Loading branch information
dantegd authored Dec 19, 2024
1 parent 9f9f66a commit 0563a85
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/cuml/cuml/tests/test_linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,12 @@ def test_logistic_regression_predict_proba(
sk_log_proba = sklog.predict_log_proba(X_test)

assert array_equal(cu_proba, sk_proba)
assert array_equal(cu_log_proba, sk_log_proba)

# if the probabilities pass test, then the margin of the logarithm
# of the probabilities can be relaxed to avoid false positives.
assert array_equal(
cu_log_proba, sk_log_proba, unit_tol=1e-2, total_tol=1e-3
)


@pytest.mark.parametrize("constructor", [np.array, cp.array, cudf.DataFrame])
Expand Down

0 comments on commit 0563a85

Please sign in to comment.