|
415 | 415 | } |
416 | 416 | ] |
417 | 417 |
|
418 | | -X_WRONG_IMAGE = [ |
419 | | - np.zeros((3, 1024, 1024, 3, 1)), |
420 | | - np.zeros((3, 512)) |
421 | | -] |
422 | 418 | X_good_image = np.zeros((3, 1024, 1024, 3)) |
423 | 419 | y_toy_image = np.array([0, 0, 1]) |
424 | 420 |
|
@@ -827,7 +823,7 @@ def test_image_cumulated_scores(X: Dict[str, ArrayLike]) -> None: |
827 | 823 | cv="prefit", |
828 | 824 | random_state=42 |
829 | 825 | ) |
830 | | - mapie.fit(cumclf.X_calib, cumclf.y_calib, image_input=True) |
| 826 | + mapie.fit(cumclf.X_calib, cumclf.y_calib) |
831 | 827 | np.testing.assert_allclose(mapie.conformity_scores_, cumclf.y_calib_scores) |
832 | 828 | # predict |
833 | 829 | _, y_ps = mapie.predict( |
@@ -894,51 +890,6 @@ def test_classifier_without_classes_attribute( |
894 | 890 | mapie.fit(X_toy, y_toy) |
895 | 891 |
|
896 | 892 |
|
897 | | -@pytest.mark.parametrize("X_wrong_image", X_WRONG_IMAGE) |
898 | | -def test_wrong_image_shape_fit(X_wrong_image: ArrayLike) -> None: |
899 | | - """ |
900 | | - Test that ValueError is raised if image has not 3 or 4 dimensions in fit. |
901 | | - """ |
902 | | - cumclf = ImageClassifier(X_wrong_image, y_toy_image) |
903 | | - cumclf.fit(cumclf.X_calib, cumclf.y_calib) |
904 | | - mapie = MapieClassifier( |
905 | | - cumclf, |
906 | | - method="cumulated_score", |
907 | | - cv="prefit", |
908 | | - random_state=42 |
909 | | - ) |
910 | | - with pytest.raises(ValueError, match=r"Invalid X.*"): |
911 | | - mapie.fit(cumclf.X_calib, cumclf.y_calib, image_input=True) |
912 | | - |
913 | | - |
914 | | -@pytest.mark.parametrize("X_wrong_image", X_WRONG_IMAGE) |
915 | | -def test_wrong_image_shape_predict(X_wrong_image: ArrayLike) -> None: |
916 | | - """ |
917 | | - Test that ValueError is raised if image has not |
918 | | - 3 or 4 dimensions in predict. |
919 | | - """ |
920 | | - cumclf = ImageClassifier(X_good_image, y_toy_image) |
921 | | - cumclf.fit(cumclf.X_calib, cumclf.y_calib) |
922 | | - mapie = MapieClassifier( |
923 | | - cumclf, |
924 | | - method="cumulated_score", |
925 | | - cv="prefit", |
926 | | - random_state=42 |
927 | | - ) |
928 | | - mapie.fit(cumclf.X_calib, cumclf.y_calib, image_input=True,) |
929 | | - with pytest.raises(ValueError, match=r"Invalid X.*"): |
930 | | - mapie.predict(X_wrong_image) |
931 | | - |
932 | | - |
933 | | -def test_undefined_model() -> None: |
934 | | - """ |
935 | | - Test ValueError is raised if no model is specified with image input. |
936 | | - """ |
937 | | - mapie = MapieClassifier() |
938 | | - with pytest.raises(ValueError, match=r"LogisticRegression's input.*"): |
939 | | - mapie.fit(X_good_image, y_toy_image, image_input=True,) |
940 | | - |
941 | | - |
942 | 893 | @pytest.mark.parametrize("method", WRONG_METHODS) |
943 | 894 | def test_method_error_in_fit(monkeypatch: Any, method: str) -> None: |
944 | 895 | """Test else condition for the method in .fit""" |
|
0 commit comments