Skip to content

test_svm fails on i386 with scipy 1.13 #29633

@drew-parsons

Description

@drew-parsons

Describe the bug

scipy 1.13 is triggering test failure in test_svc_ovr_tie_breaking[NuSVC] on i386 architecture.

The error can be seeing in debian CI tests, https://ci.debian.net/packages/s/scikit-learn/unstable/i386/
Full test log at https://ci.debian.net/packages/s/scikit-learn/unstable/i386/50043538/
or https://ci.debian.net/packages/s/scikit-learn/testing/i386/50043537/

Steps/Code to Reproduce

On an i386 system with scipy 1.13 installed

$ pytest-3 /usr/lib/python3/dist-packages/sklearn/svm/tests/test_svm.py -k test_svc_ovr_tie_breaking

Expected Results

test should pass

Actual Results

1333s _______________________ test_svc_ovr_tie_breaking[NuSVC] _______________________
1333s 
1333s SVCClass = <class 'sklearn.svm._classes.NuSVC'>
1333s 
1333s     @pytest.mark.parametrize("SVCClass", [svm.SVC, svm.NuSVC])
1333s     def test_svc_ovr_tie_breaking(SVCClass):
1333s         """Test if predict breaks ties in OVR mode.
1333s         Related issue: https://github.com/scikit-learn/scikit-learn/issues/8277
1333s         """
1333s         X, y = make_blobs(random_state=0, n_samples=20, n_features=2)
1333s     
1333s         xs = np.linspace(X[:, 0].min(), X[:, 0].max(), 100)
1333s         ys = np.linspace(X[:, 1].min(), X[:, 1].max(), 100)
1333s         xx, yy = np.meshgrid(xs, ys)
1333s     
1333s         common_params = dict(
1333s             kernel="rbf", gamma=1e6, random_state=42, decision_function_shape="ovr"
1333s         )
1333s         svm = SVCClass(
1333s             break_ties=False,
1333s             **common_params,
1333s         ).fit(X, y)
1333s         pred = svm.predict(np.c_[xx.ravel(), yy.ravel()])
1333s         dv = svm.decision_function(np.c_[xx.ravel(), yy.ravel()])
1333s >       assert not np.all(pred == np.argmax(dv, axis=1))
1333s E       assert not True
1333s E        +  where True = <function all at 0xf689d5e0>(array([1, 1, 1, ..., 1, 1, 1]) == array([1, 1, ..., dtype=int32)
1333s E        +    where <function all at 0xf689d5e0> = np.all
1333s E           
1333s E           Full diff:
1333s E           - array([1, 1, 1, ..., 1, 1, 1], dtype=int32)
1333s E           ?                              -------------
1333s E           + array([1, 1, 1, ..., 1, 1, 1]))
1333s 
1333s /usr/lib/python3/dist-packages/sklearn/svm/tests/test_svm.py:1225: AssertionError

Versions

$ python3 -c "import sklearn; sklearn.show_versions()"
# (on amd64, edited manually for i386)

System:
    python: 3.12.4 (main, Jul 15 2024, 12:17:32) [GCC 13.3.0]
executable: /usr/bin/python3
   machine: Linux-6.9.11-i386-i686-with-glibc2.39

Python dependencies:
      sklearn: 1.4.2
          pip: 24.1.1
   setuptools: 70.3.0
        numpy: 1.26.4
        scipy: 1.13.1
       Cython: 3.0.10
       pandas: 2.2.2+dfsg
   matplotlib: 3.8.3
       joblib: 1.3.2
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /usr/lib/i386-linux-gnu/openblas-pthread/libopenblasp-r0.3.27.so
        version: 0.3.27
threading_layer: pthreads
   architecture: Haswell
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: libgomp
       filepath: /usr/lib/i386-linux-gnu/libgomp.so.1.0.0
        version: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions