8000 Failing tests due to scipy.optimize DeprecationWarnings · Issue #18752 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Failing tests due to scipy.optimize DeprecationWarnings #18752
Closed
@cmarmo

Description

@cmarmo

Describe the bug

The following tests fail with an old version of scipy

This is due to the fact that some scipy.optimize DeprecationWarning are thrown. Filtering them with
@pytest.mark.filterwarnings("ignore::DeprecationWarning") seems not to prevent record to remember those DeprecationWarning.

New scipy versions are not affected by this bug but the goal of this tests is to check the number of ConvergenceWarning on specific parameters and they should probably pass independently from other warnings.

Steps/Code to Reproduce

$ pytest sklearn/gaussian_process/tests/test_gpc.py

Expected Results

The test pass

Actual Results

============================================================= FAILURES ==============================================================
________________________________________________________ test_warning_bounds ____________________
5D9E
____________________________________

    def test_warning_bounds():
        kernel = RBF(length_scale_bounds=[1e-5, 1e-3])
        gpc = GaussianProcessClassifier(kernel=kernel)
        assert_warns_message(ConvergenceWarning, "The optimal value found for "
                                                 "dimension 0 of parameter "
                                                 "length_scale is close to "
                                                 "the specified upper bound "
                                                 "0.001. Increasing the bound "
                                                 "and calling fit again may "
                                                 "find a better value.",
                             gpc.fit, X, y)
    
        kernel_sum = (WhiteKernel(noise_level_bounds=[1e-5, 1e-3]) +
                      RBF(length_scale_bounds=[1e3, 1e5]))
        gpc_sum = GaussianProcessClassifier(kernel=kernel_sum)
        with pytest.warns(None) as record:
            gpc_sum.fit(X, y)
    
>       assert len(record) == 2
E       assert 7 == 2
E        +  where 7 = len(WarningsChecker(record=True))

sklearn/gaussian_process/tests/test_gpc.py:206: AssertionError

Versions

 pytest 6.1.1

System:
    python: 3.7.9 (default, Aug 31 2020, 12:42:55)  [GCC 7.3.0]
executable: /home/cmarmo/.conda/envs/sklearn-travis/bin/python
   machine: Linux-5.8.13-200.fc32.x86_64-x86_64-with-fedora-32-Thirty_Two

Python dependencies:
          pip: 20.2.4
   setuptools: 50.3.0.post20201006
      sklearn: 0.24.dev0
        numpy: 1.19.2
        scipy: 1.3.0
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 0.17.0
threadpoolctl: 2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugLow PriorityLow priority issues and pull requestsmodule:test-suiteeverything related to our tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0