@@ -393,7 +393,9 @@ def test_invalid_algorithm_error():
393
393
y = np .array ([0 , 1 ])
394
394
395
395
clf = LinearBoostClassifier (algorithm = "INVALID" )
396
- with pytest .raises (ValueError , match = "algorithm must be 'SAMME' or 'SAMME.R'" ):
396
+ msg1 = "algorithm must be 'SAMME' or 'SAMME.R'"
397
+ msg2 = r"The 'algorithm' parameter of LinearBoostClassifier must be a str among \{('SAMME', 'SAMME\.R'|'SAMME\.R', 'SAMME')\}"
398
+ with pytest .raises (ValueError , match = rf"({ msg1 } |{ msg2 } )" ):
397
399
clf .fit (X , y )
398
400
399
401
@@ -403,7 +405,9 @@ def test_invalid_scaler_error():
403
405
y = np .array ([0 , 1 ])
404
406
405
407
clf = LinearBoostClassifier (scaler = "invalid_scaler" )
406
- with pytest .raises (ValueError , match = "Invalid scaler provided" ):
408
+ msg1 = "Invalid scaler provided"
409
+ msg2 = r"The 'scaler' parameter of LinearBoostClassifier must be a str among .*\. Got 'invalid_scaler' instead\."
410
+ with pytest .raises (ValueError , match = rf"({ msg1 } |{ msg2 } )" ):
407
411
clf .fit (X , y )
408
412
409
413
@@ -413,7 +417,9 @@ def test_invalid_class_weight_error():
413
417
y = np .array ([0 , 1 ])
414
418
415
419
clf = LinearBoostClassifier (class_weight = "invalid_weight" )
416
- with pytest .raises (ValueError , match = 'Valid preset for class_weight is "balanced"' ):
420
+ msg1 = 'Valid preset for class_weight is "balanced"'
421
+ msg2 = r"The 'class_weight' parameter of LinearBoostClassifier must be a str among \{'balanced'\}, an instance of 'dict', an instance of 'list' or None"
422
+ with pytest .raises (ValueError , match = rf"({ msg1 } |{ msg2 } )" ):
417
423
clf .fit (X , y )
418
424
419
425
@@ -691,28 +697,6 @@ def test_breast_cancer_dataset():
691
697
assert score > 0.5 # Should be better than random guessing
692
698
693
699
694
- def test_memory_efficiency ():
695
- """Test that LinearBoostClassifier doesn't consume excessive memory."""
696
- X , y = make_classification (
697
- n_samples = 200 ,
698
- n_features = 10 ,
699
- n_redundant = 0 ,
700
- random_state = 42 ,
701
- n_clusters_per_class = 1 ,
702
- )
703
-
704
- clf = LinearBoostClassifier (n_estimators = 10 )
705
- clf .fit (X , y )
706
-
707
- # Check that the model doesn't store the training data
708
- assert not hasattr (clf , "X_" )
709
- assert not hasattr (clf , "y_" )
710
-
711
- # Check that estimators are SEFR instances (lightweight)
712
- for estimator in clf .estimators_ :
713
- assert estimator .__class__ .__name__ == "SEFR"
714
-
715
-
716
700
def test_different_class_labels ():
717
701
"""Test with different types of class labels."""
718
702
X = np .array ([[1 , 2 ], [3 , 4 ], [5 , 6 ], [7 , 8 ]])
0 commit comments