Skip to content

Commit b3b0669

Browse files
authored
Modify test to permit higher cardinality cases for label model (#1637)
1 parent a5bc232 commit b3b0669

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/labeling/model/test_label_model.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,10 @@ def test_label_model_basic(self) -> None:
559559

560560
# Test estimated LF conditional probabilities
561561
P_lm = label_model.get_conditional_probs()
562-
np.testing.assert_array_almost_equal(P, P_lm, decimal=2)
562+
conditional_probs_err = (
563+
np.linalg.norm(P.flatten() - P_lm.flatten(), ord=1) / P.size
564+
)
565+
self.assertLessEqual(conditional_probs_err, 0.01)
563566

564567
# Test predicted labels
565568
score = label_model.score(L, Y)
@@ -583,7 +586,10 @@ def test_label_model_sparse(self) -> None:
583586

584587
# Test estimated LF conditional probabilities
585588
P_lm = label_model.get_conditional_probs()
586-
np.testing.assert_array_almost_equal(P, P_lm, decimal=2)
589+
conditional_probs_err = (
590+
np.linalg.norm(P.flatten() - P_lm.flatten(), ord=1) / P.size
591+
)
592+
self.assertLessEqual(conditional_probs_err, 0.01)
587593

588594
# Test predicted labels *only on non-abstained data points*
589595
Y_pred = label_model.predict(L, tie_break_policy="abstain")

0 commit comments

Comments
 (0)