File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -547,6 +547,8 @@ def _set_class_balance(
547
547
548
548
def _set_constants (self , L : np .ndarray ) -> None :
549
549
self .n , self .m = L .shape
550
+ if self .m < 3 :
551
+ raise ValueError (f"L_train should have at least 3 labeling functions" )
550
552
self .t = 1
551
553
552
554
def _create_tree (self ) -> None :
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ def test_L_form(self):
38
38
with self .assertRaisesRegex (ValueError , "L_train has cardinality" ):
39
39
label_model .fit (L , n_epochs = 1 )
40
40
41
+ L = np .array ([[0 ], [1 ], [- 1 ]])
42
+ with self .assertRaisesRegex (ValueError , "L_train should have at least 3" ):
43
+ label_model .fit (L , n_epochs = 1 )
44
+
41
45
def test_class_balance (self ):
42
46
label_model = LabelModel (cardinality = 2 , verbose = False )
43
47
# Test class balance
You can’t perform that action at this time.
0 commit comments