Skip to content

⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev (last failure: Jun 21, 2024) ⚠️ #29325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scikit-learn-bot opened this issue Jun 21, 2024 · 1 comment · Fixed by #29328
Labels
Needs Triage Issue requires triage

Comments

@scikit-learn-bot
Copy link
Contributor

CI failed on Linux_Nightly.pylatest_pip_scipy_dev (Jun 21, 2024)

  • test_check_inplace_ensure_writeable[KernelPCA()]
@github-actions github-actions bot added the Needs Triage Issue requires triage label Jun 21, 2024
@lesteve
Copy link
Member

lesteve commented Jun 21, 2024

Ohoh looks like one for @jeremiedbb 😉, a few other builds are broken with the same issue.

image

Probably a combination of #29018 + #29100.

Using Github Merge queues would have avoided it I guess but this kind of edge case happens so rarely that I don't think we should bother ...

Here is what the error looks like:

================================== FAILURES ===================================
______________ test_check_inplace_ensure_writeable[KernelPCA()] _______________

estimator = KernelPCA(copy_X=False, kernel='precomputed')

    @pytest.mark.parametrize(
        "estimator", _tested_estimators(), ids=_get_check_estimator_ids
    )
    def test_check_inplace_ensure_writeable(estimator):
        name = estimator.__class__.__name__
    
        if hasattr(estimator, "copy"):
            estimator.set_params(copy=False)
        elif hasattr(estimator, "copy_X"):
            estimator.set_params(copy_X=False)
        else:
            raise SkipTest(f"{name} doesn't require writeable input.")
    
        _set_checking_parameters(estimator)
    
        # The following estimators can work inplace only with certain settings
        if name == "HDBSCAN":
            estimator.set_params(metric="precomputed", algorithm="brute")
    
        if name == "PCA":
            estimator.set_params(svd_solver="full")
    
        if name == "KernelPCA":
            estimator.set_params(kernel="precomputed")
    
>       check_inplace_ensure_writeable(name, estimator)

Python\Lib\site-packages\sklearn\tests\test_common.py:648: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Python\Lib\site-packages\sklearn\utils\_testing.py:151: in wrapper
    return fn(*args, **kwargs)
Python\Lib\site-packages\sklearn\utils\estimator_checks.py:4764: in check_inplace_ensure_writeable
    estimator.fit(X, y)
Python\Lib\site-packages\sklearn\base.py:1514: in wrapper
    return fit_method(estimator, *args, **kwargs)
Python\Lib\site-packages\sklearn\decomposition\_kernel_pca.py:443: in fit
    self._fit_transform_in_place(K)
Python\Lib\site-packages\sklearn\decomposition\_kernel_pca.py:330: in _fit_transform_in_place
    K = self._centerer.fit(K).transform(K, copy=False)
Python\Lib\site-packages\sklearn\utils\_set_output.py:313: in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = KernelCenterer()
K = array([[ 9.73855706e+00,  8.03906192e+00, -8.08995063e+00, ...,
        -8.23304619e+00, -9.40415982e+00,  1.15996793e...  [ 1.15996793e+01,  1.34901489e+01, -4.71531831e+00, ...,
         1.31699789e+01,  1.33525719e+01,  1.81886536e+01]])
copy = False

    def transform(self, K, copy=True):
        """Center kernel matrix.
    
        Parameters
        ----------
        K : ndarray of shape (n_samples1, n_samples2)
            Kernel matrix.
    
        copy : bool, default=True
            Set to False to perform inplace computation.
    
        Returns
        -------
        K_new : ndarray of shape (n_samples1, n_samples2)
            Returns the instance itself.
        """
        check_is_fitted(self)
    
        xp, _ = get_namespace(K)
    
        K = self._validate_data(
            K, copy=copy, dtype=_array_api.supported_float_dtypes(xp), reset=False
        )
    
        K_pred_cols = (xp.sum(K, axis=1) / self.K_fit_rows_.shape[0])[:, None]
    
>       K -= self.K_fit_rows_
E       ValueError: output array is read-only

Python\Lib\site-packages\sklearn\preprocessing\_data.py:2443: ValueError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage Issue requires triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants