scikit-learn / scikit-learn/scikit-learn

test_unreachable_accuracy can be reached on aarch64

Open
#15,825 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

arch:arm module:test-suite
Dominant language
Python
Stars
67.3k
Forks
27.4k
Avg merge
1d 15h
Merged PRs (30d)
58

Description

https://cloud.drone.io/conda-forge/scikit-learn-feedstock/44/2/2

__________________________ test_unreachable_accuracy ___________________________
[gw6] linux -- Python 3.7.3 $PREFIX/bin/python

    def test_unreachable_accuracy():
        assert_array_almost_equal(
            orthogonal_mp(X, y, tol=0),
            orthogonal_mp(X, y, n_nonzero_coefs=n_features))
    
        assert_array_almost_equal(
            assert_warns(RuntimeWarning, orthogonal_mp, X, y, tol=0,
>                        precompute=True),
            orthogonal_mp(X, y, precompute=True,
                          n_nonzero_coefs=n_features))

../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.7/site-packages/sklearn/linear_model/tests/test_omp.py:79: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

warning_class = <class 'RuntimeWarning'>
func = <function orthogonal_mp at 0xffff965950d0>
args = (array([[ 2.91575919e+00,  1.14685480e+00,  1.81414114e+00,
         3.47278472e+00,  3.69900930e+00, -1.89437288e+00,...   0.06811033],
       [  2.63341917,   0.14703522,   1.76173811],
       [  2.03115852,  -3.98034558,  -6.03227139]]))
kw = {'precompute': True, 'tol': 0}, w = []
result = array([[ 0.        ,  0.        ,  0.        ],
       [ 0.        ,  0.        ,  0.        ],
       [ 0.        ,  ...       ,  0.        ],
       [ 0.        ,  0.        ,  0.        ],
       [ 0.        ,  0.        ,  0.        ]])

    def assert_warns(warning_class, func, *args, **kw):
        """Test that a certain warning occurs.
    
        Parameters
        ----------
        warning_class : the warning class
            The class to test for, e.g. UserWarning.
    
        func : callable
            Callable object to trigger warnings.
    
        *args : the positional arguments to `func`.
    
        **kw : the keyword arguments to `func`
    
        Returns
        -------
    
        result : the return value of `func`
    
        """
        with warnings.catch_warnings(record=True) as w:
            # Cause all warnings to always be triggered.
            warnings.simplefilter("always")
            # Trigger a warning.
            result = func(*args, **kw)
            if hasattr(np, 'FutureWarning'):
                # Filter out numpy-specific warnings in numpy >= 1.9
                w = [e for e in w
                     if e.category is not np.VisibleDeprecationWarning]
    
            # Verify some things
            if not len(w) > 0:
                raise AssertionError("No warning raised when calling %s"
>                                    % func.__name__)
E               AssertionError: No warning raised when calling orthogonal_mp

../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.7/site-packages/sklearn/utils/_testing.py:133: AssertionError

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with sklearn/linear_model/tests/test_omp.py, especially test_unreachable_accuracy around line 79, and reproduce the failure on aarch64. Read the orthogonal_mp call path and the assert_warns helper shown in the traceback. Done means the test's expected RuntimeWarning behavior is consistent and the test passes on aarch64.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.