41
41
from autosklearn .experimental .askl2 import AutoSklearn2Classifier
42
42
from autosklearn .smbo import get_smac_object
43
43
44
- from ..test_pipeline .ignored_warnings import ignore_warnings
45
-
46
44
sys .path .append (os .path .dirname (__file__ ))
47
45
from automl_utils import print_debug_information , count_succeses , includes_train_scores , includes_all_scores , include_single_scores , performance_over_time_is_plausible # noqa (E402: module level import not at top of file)
48
46
@@ -82,8 +80,7 @@ def __call__(self, *args, **kwargs):
82
80
max_models_on_disc = None ,
83
81
)
84
82
85
- with ignore_warnings ():
86
- automl .fit (X_train , Y_train )
83
+ automl .fit (X_train , Y_train )
87
84
88
85
# Test that the argument is correctly passed to SMAC
89
86
assert getattr (get_smac_object_wrapper_instance , 'n_jobs' ) == 2
@@ -277,8 +274,7 @@ def test_performance_over_time_no_ensemble(tmp_dir):
277
274
initial_configurations_via_metalearning = 0 ,
278
275
ensemble_size = 0 ,)
279
276
280
- with ignore_warnings ():
281
- cls .fit (X_train , Y_train , X_test , Y_test )
277
+ cls .fit (X_train , Y_train , X_test , Y_test )
282
278
283
279
performance_over_time = cls .performance_over_time_
284
280
assert include_single_scores (performance_over_time .columns ) is True
@@ -302,8 +298,7 @@ def test_cv_results(tmp_dir):
302
298
params = cls .get_params ()
303
299
original_params = copy .deepcopy (params )
304
300
305
- with ignore_warnings ():
306
- cls .fit (X_train , Y_train )
301
+ cls .fit (X_train , Y_train )
307
302
308
303
cv_results = cls .cv_results_
309
304
assert isinstance (cv_results , dict ), type (cv_results )
@@ -391,8 +386,7 @@ def test_leaderboard(
391
386
seed = 1
392
387
)
393
388
394
- with ignore_warnings ():
395
- model .fit (X_train , Y_train )
389
+ model .fit (X_train , Y_train )
396
390
397
391
for params in params_generator :
398
392
# Convert from iterator to solid list
@@ -551,8 +545,7 @@ def test_can_pickle_classifier(tmp_dir, dask_client):
551
545
dask_client = dask_client ,
552
546
)
553
547
554
- with ignore_warnings ():
555
- automl .fit (X_train , Y_train )
548
+ automl .fit (X_train , Y_train )
556
549
557
550
initial_predictions = automl .predict (X_test )
558
551
initial_accuracy = sklearn .metrics .accuracy_score (Y_test ,
@@ -601,8 +594,7 @@ def test_multilabel(tmp_dir, dask_client):
601
594
dask_client = dask_client ,
602
595
)
603
596
604
- with ignore_warnings ():
605
- automl .fit (X_train , Y_train )
597
+ automl .fit (X_train , Y_train )
606
598
607
599
predictions = automl .predict (X_test )
608
600
assert predictions .shape == (50 , 3 ), print_debug_information (automl )
@@ -628,9 +620,8 @@ def test_binary(tmp_dir, dask_client):
628
620
dask_client = dask_client ,
629
621
)
630
622
631
- with ignore_warnings ():
632
- automl .fit (X_train , Y_train , X_test = X_test , y_test = Y_test ,
633
- dataset_name = 'binary_test_dataset' )
623
+ automl .fit (X_train , Y_train , X_test = X_test , y_test = Y_test ,
624
+ dataset_name = 'binary_test_dataset' )
634
625
635
626
predictions = automl .predict (X_test )
636
627
assert predictions .shape == (50 , ), print_debug_information (automl )
@@ -665,15 +656,13 @@ def test_classification_pandas_support(tmp_dir, dask_client):
665
656
tmp_folder = tmp_dir ,
666
657
)
667
658
668
- with ignore_warnings ():
669
- automl .fit (X , y )
659
+ automl .fit (X , y )
670
660
671
661
# Make sure that at least better than random.
672
662
# We use same X_train==X_test to test code quality
673
663
assert automl .score (X , y ) > 0.555 , print_debug_information (automl )
674
664
675
- with ignore_warnings ():
676
- automl .refit (X , y )
665
+ automl .refit (X , y )
677
666
678
667
# Make sure that at least better than random.
679
668
# accuracy in sklearn needs valid data
@@ -694,8 +683,7 @@ def test_regression(tmp_dir, dask_client):
694
683
dask_client = dask_client ,
695
684
)
696
685
697
- with ignore_warnings ():
698
- automl .fit (X_train , Y_train )
686
+ automl .fit (X_train , Y_train )
699
687
700
688
predictions = automl .predict (X_test )
701
689
assert predictions .shape == (356 ,)
@@ -724,8 +712,7 @@ def test_cv_regression(tmp_dir, dask_client):
724
712
dask_client = dask_client ,
725
713
)
726
714
727
- with ignore_warnings ():
728
- automl .fit (X_train , Y_train )
715
+ automl .fit (X_train , Y_train )
729
716
730
717
predictions = automl .predict (X_test )
731
718
assert predictions .shape == (206 ,)
@@ -754,15 +741,13 @@ def test_regression_pandas_support(tmp_dir, dask_client):
754
741
)
755
742
756
743
# Make sure we error out because y is not encoded
757
- with ignore_warnings ():
758
- automl .fit (X , y )
744
+ automl .fit (X , y )
759
745
760
746
# Make sure that at least better than random.
761
747
# We use same X_train==X_test to test code quality
762
748
assert automl .score (X , y ) >= 0.5 , print_debug_information (automl )
763
749
764
- with ignore_warnings ():
765
- automl .refit (X , y )
750
+ automl .refit (X , y )
766
751
767
752
# Make sure that at least better than random.
768
753
assert r2 (y , automl .predict (X )) > 0.5 , print_debug_information (automl )
@@ -784,16 +769,14 @@ def test_autosklearn_classification_methods_returns_self(dask_client):
784
769
dask_client = dask_client ,
785
770
exclude = {'feature_preprocessor' : ['fast_ica' ]})
786
771
787
- with ignore_warnings ():
788
- automl_fitted = automl .fit (X_train , y_train )
772
+ automl_fitted = automl .fit (X_train , y_train )
789
773
790
774
assert automl is automl_fitted
791
775
792
776
automl_ensemble_fitted = automl .fit_ensemble (y_train , ensemble_size = 5 )
793
777
assert automl is automl_ensemble_fitted
794
778
795
- with ignore_warnings ():
796
- automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
779
+ automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
797
780
798
781
assert automl is automl_refitted
799
782
@@ -808,15 +791,13 @@ def test_autosklearn_regression_methods_returns_self(dask_client):
808
791
dask_client = dask_client ,
809
792
ensemble_size = 0 )
810
793
811
- with ignore_warnings ():
812
- automl_fitted = automl .fit (X_train , y_train )
794
+ automl_fitted = automl .fit (X_train , y_train )
813
795
assert automl is automl_fitted
814
796
815
797
automl_ensemble_fitted = automl .fit_ensemble (y_train , ensemble_size = 5 )
816
798
assert automl is automl_ensemble_fitted
817
799
818
- with ignore_warnings ():
819
- automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
800
+ automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
820
801
assert automl is automl_refitted
821
802
822
803
@@ -826,16 +807,14 @@ def test_autosklearn2_classification_methods_returns_self(dask_client):
826
807
delete_tmp_folder_after_terminate = False ,
827
808
dask_client = dask_client )
828
809
829
- with ignore_warnings ():
830
- automl_fitted = automl .fit (X_train , y_train )
810
+ automl_fitted = automl .fit (X_train , y_train )
831
811
832
812
assert automl is automl_fitted
833
813
834
814
automl_ensemble_fitted = automl .fit_ensemble (y_train , ensemble_size = 5 )
835
815
assert automl is automl_ensemble_fitted
836
816
837
- with ignore_warnings ():
838
- automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
817
+ automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
839
818
840
819
assert automl is automl_refitted
841
820
@@ -853,16 +832,14 @@ def test_autosklearn2_classification_methods_returns_self_sparse(dask_client):
853
832
delete_tmp_folder_after_terminate = False ,
854
833
dask_client = dask_client )
855
834
856
- with ignore_warnings ():
857
- automl_fitted = automl .fit (X_train , y_train )
835
+ automl_fitted = automl .fit (X_train , y_train )
858
836
859
837
assert automl is automl_fitted
860
838
861
839
automl_ensemble_fitted = automl .fit_ensemble (y_train , ensemble_size = 5 )
862
840
assert automl is automl_ensemble_fitted
863
841
864
- with ignore_warnings ():
865
- automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
842
+ automl_refitted = automl .refit (X_train .copy (), y_train .copy ())
866
843
867
844
assert automl is automl_refitted
868
845
@@ -967,16 +944,15 @@ def test_fit_pipeline(dask_client, task_type, resampling_strategy, disable_file_
967
944
X_test = X_test , y_test = y_test ,
968
945
).get_default_configuration ()
969
946
970
- with ignore_warnings ():
971
- pipeline , run_info , run_value = automl .fit_pipeline (
972
- X = X_train ,
973
- y = y_train ,
974
- config = config ,
975
- X_test = X_test ,
976
- y_test = y_test ,
977
- disable_file_output = disable_file_output ,
978
- resampling_strategy = resampling_strategy
979
- )
947
+ pipeline , run_info , run_value = automl .fit_pipeline (
948
+ X = X_train ,
949
+ y = y_train ,
950
+ config = config ,
951
+ X_test = X_test ,
952
+ y_test = y_test ,
953
+ disable_file_output = disable_file_output ,
954
+ resampling_strategy = resampling_strategy
955
+ )
980
956
981
957
assert isinstance (run_info .config , Configuration )
982
958
assert run_info .cutoff == 30
@@ -1076,11 +1052,10 @@ def test_pass_categorical_and_numeric_columns_to_pipeline(
1076
1052
)
1077
1053
config = config_space .get_default_configuration ()
1078
1054
1079
- with ignore_warnings ():
1080
- pipeline , _ , run_value = automl .fit_pipeline (
1081
- X = X_train , y = y_train , X_test = X_test , y_test = y_test ,
1082
- config = config , feat_type = feat_type ,
1083
- )
1055
+ pipeline , _ , run_value = automl .fit_pipeline (
1056
+ X = X_train , y = y_train , X_test = X_test , y_test = y_test ,
1057
+ config = config , feat_type = feat_type ,
1058
+ )
1084
1059
1085
1060
assert pipeline is not None , "Expected a pipeline from automl.fit_pipeline"
1086
1061
@@ -1129,17 +1104,15 @@ def test_autosklearn_anneal(as_frame):
1129
1104
resampling_strategy = 'holdout-iterative-fit' )
1130
1105
1131
1106
if as_frame :
1132
- with ignore_warnings ():
1133
- # Let autosklearn calculate the feat types
1134
- automl_fitted = automl .fit (X , y )
1107
+ # Let autosklearn calculate the feat types
1108
+ automl_fitted = automl .fit (X , y )
1135
1109
1136
1110
else :
1137
1111
X_ , y_ = sklearn .datasets .fetch_openml (data_id = 2 , return_X_y = True , as_frame = True )
1138
1112
feat_type = ['categorical' if X_ [col ].dtype .name == 'category' else 'numerical'
1139
1113
for col in X_ .columns ]
1140
1114
1141
- with ignore_warnings ():
1142
- automl_fitted = automl .fit (X , y , feat_type = feat_type )
1115
+ automl_fitted = automl .fit (X , y , feat_type = feat_type )
1143
1116
1144
1117
assert automl is automl_fitted
1145
1118
0 commit comments