Skip to content

TestFCIT tests with scikit-learn 1.6.1 #427

Open
@doronbehar

Description

We observed the following on NixOS (ref NixOS/nixpkgs#376175 ).

=================================== FAILURES ===================================
________________ TestFCIT.test_null[1-100000--0.16024-0.56139] _________________

self = <hyppo.conditional.tests.test_FCIT.TestFCIT object at 0x7ffff6bf29f0>
dim = 1, n = 100000, obs_stat = -0.16024, obs_pvalue = 0.56139

    @pytest.mark.parametrize(
        "dim, n, obs_stat, obs_pvalue",
        [(1, 100000, -0.16024, 0.56139), (2, 100000, -4.59882, 0.99876)],
    )
    def test_null(self, dim, n, obs_stat, obs_pvalue):
        np.random.seed(12)
        z1 = np.random.multivariate_normal(
            mean=np.zeros(dim), cov=np.eye(dim), size=(n)
        )
        A1 = np.random.normal(loc=0, scale=1, size=dim * dim).reshape(dim, dim)
        B1 = np.random.normal(loc=0, scale=1, size=dim * dim).reshape(dim, dim)
        x1 = (
            A1 @ z1.T
            + np.random.multivariate_normal(
                mean=np.zeros(dim), cov=np.eye(dim), size=(n)
            ).T
        )
        y1 = (
            B1 @ z1.T
            + np.random.multivariate_normal(
                mean=np.zeros(dim), cov=np.eye(dim), size=(n)
            ).T
        )
    
        np.random.seed(122)
        stat, pvalue = FCIT().test(x1.T, y1.T, z1)
    
>       assert_almost_equal(pvalue, obs_pvalue, decimal=4)
E       AssertionError: 
E       Arrays are not almost equal to 4 decimals
E        ACTUAL: np.float64(0.5259896558151667)
E        DESIRED: 0.56139

hyppo/conditional/tests/test_FCIT.py:53: AssertionError
_________ TestFCIT.test_alternative[1-100000-89.271754-2.91447597e-12] _________

self = <hyppo.conditional.tests.test_FCIT.TestFCIT object at 0x7ffee20ffaa0>
dim = 1, n = 100000, obs_stat = 89.271754, obs_pvalue = 2.91447597e-12

    @pytest.mark.parametrize(
        "dim, n, obs_stat, obs_pvalue",
        [
            (1, 100000, 89.271754, 2.91447597e-12),
            (2, 100000, 161.35165, 4.63412957e-14),
        ],
    )
    def test_alternative(self, dim, n, obs_stat, obs_pvalue):
        np.random.seed(12)
        z2 = np.random.multivariate_normal(
            mean=np.zeros(dim), cov=np.eye(dim), size=(n)
        )
    
        A2 = np.random.normal(loc=0, scale=1, size=dim * dim).reshape(dim, dim)
        B2 = np.random.normal(loc=0, scale=1, size=dim * dim).reshape(dim, dim)
    
        x2 = (
            A2 @ z2.T
            + np.random.multivariate_normal(
                mean=np.zeros(dim), cov=np.eye(dim), size=(n)
            ).T
        )
        y2 = (
            B2 @ x2
            + np.random.multivariate_normal(
                mean=np.zeros(dim), cov=np.eye(dim), size=(n)
            ).T
        )
    
        np.random.seed(122)
        stat, pvalue = FCIT().test(x2.T, y2.T, z2)
    
        assert_almost_equal(pvalue, obs_pvalue, decimal=12)
>       assert_almost_equal(stat, obs_stat, decimal=4)
E       AssertionError: 
E       Arrays are not almost equal to 4 decimals
E        ACTUAL: np.float64(89.18478417501757)
E        DESIRED: 89.271754

hyppo/conditional/tests/test_FCIT.py:89: AssertionError
_________ TestFCIT.test_alternative[2-100000-161.35165-4.63412957e-14] _________

self = <hyppo.conditional.tests.test_FCIT.TestFCIT object at 0x7ffee20ffc50>
dim = 2, n = 100000, obs_stat = 161.35165, obs_pvalue = 4.63412957e-14

    @pytest.mark.parametrize(
        "dim, n, obs_stat, obs_pvalue",
        [
            (1, 100000, 89.271754, 2.91447597e-12),
            (2, 100000, 161.35165, 4.63412957e-14),
        ],
    )
    def test_alternative(self, dim, n, obs_stat, obs_pvalue):
        np.random.seed(12)
        z2 = np.random.multivariate_normal(
            mean=np.zeros(dim), cov=np.eye(dim), size=(n)
        )
    
        A2 = np.random.normal(loc=0, scale=1, size=dim * dim).reshape(dim, dim)
        B2 = np.random.normal(loc=0, scale=1, size=dim * dim).reshape(dim, dim)
    
        x2 = (
            A2 @ z2.T
            + np.random.multivariate_normal(
                mean=np.zeros(dim), cov=np.eye(dim), size=(n)
            ).T
        )
        y2 = (
            B2 @ x2
            + np.random.multivariate_normal(
                mean=np.zeros(dim), cov=np.eye(dim), size=(n)
            ).T
        )
    
        np.random.seed(122)
        stat, pvalue = FCIT().test(x2.T, y2.T, z2)
    
        assert_almost_equal(pvalue, obs_pvalue, decimal=12)
>       assert_almost_equal(stat, obs_stat, decimal=4)
E       AssertionError: 
E       Arrays are not almost equal to 4 decimals
E        ACTUAL: np.float64(161.35105053962008)
E        DESIRED: 161.35165

hyppo/conditional/tests/test_FCIT.py:89: AssertionError
=============================== warnings summary ===============================
hyppo/independence/hhg.py:3
  /build/source/hyppo/independence/hhg.py:3: DeprecationWarning: Please import `random` from the `scipy.sparse` namespace; the `scipy.sparse.construct` namespace is deprecated and will be removed in SciPy 2.0.0.
    from scipy.sparse.construct import random

../../nix/store/58c4g76sz355ds1h921nsdn0dl5y9xs0-python3.12-autograd-1.7.0/lib/python3.12/site-packages/autograd/numpy/numpy_wrapper.py:7
  /nix/store/58c4g76sz355ds1h921nsdn0dl5y9xs0-python3.12-autograd-1.7.0/lib/python3.12/site-packages/autograd/numpy/numpy_wrapper.py:7: DeprecationWarning: numpy.core.einsumfunc is deprecated and has been renamed to numpy._core.einsumfunc. The numpy._core namespace contains private NumPy internals and its use is discouraged, as NumPy internals can change without warning in any release. In practice, most real-world usage of numpy.core is to access functionality in the public NumPy API. If that is the case, use the public NumPy API. If not, you are using NumPy internals. If you would still like to access an internal attribute, use numpy._core.einsumfunc._parse_einsum_input.
    from numpy.core.einsumfunc import _parse_einsum_input

hyppo/kgof/kernel.py:93
  /build/source/hyppo/kgof/kernel.py:93: SyntaxWarning: invalid escape sequence '\s'
    """

hyppo/kgof/kernel.py:132
  /build/source/hyppo/kgof/kernel.py:132: SyntaxWarning: invalid escape sequence '\s'
    """

hyppo/kgof/kernel.py:234
  /build/source/hyppo/kgof/kernel.py:234: SyntaxWarning: invalid escape sequence '\s'
    """

hyppo/kgof/tests/test_density.py:4
  /build/source/hyppo/kgof/tests/test_density.py:4: DeprecationWarning: Please import `norm` from the `scipy.linalg` namespace; the `scipy.linalg.misc` namespace is deprecated and will be removed in SciPy 2.0.0.
    from scipy.linalg.misc import norm

hyppo/conditional/tests/test_FCIT.py: 256 warnings
  /nix/store/5983z0gcij82c0p8k5zx5wb93am72nzs-python3.12-joblib-1.4.2/lib/python3.12/site-packages/joblib/externals/loky/backend/fork_exec.py:38: DeprecationWarning: This process (pid=497) is multi-threaded, use of fork() may lead to deadlocks in the child.
    pid = os.fork()

hyppo/discrim/tests/test_discrim_one_samp.py::TestOneSample::test_same_one
hyppo/discrim/tests/test_discrim_one_samp.py::TestOneSample::test_diff_one
  /build/source/hyppo/tools/common.py:92: RuntimeWarning: The number of replications is low (under 1000), and p-value calculations may be unreliable. Use the p-value result, with caution!
    warnings.warn(msg, RuntimeWarning)

hyppo/independence/tests/test_kmerf.py::TestKMERFStat::test_oned[linear-0.26096478961164743-2.210668062138582e-07]
hyppo/independence/tests/test_kmerf.py::TestKMERFStat::test_oned[linear-0.26096478961164743-2.210668062138582e-07]
hyppo/independence/tests/test_kmerf.py::TestKMERFStat::test_oned[spiral-0.038750928574255245-0.031366764487060314]
hyppo/independence/tests/test_kmerf.py::TestKMERFStat::test_oned[spiral-0.038750928574255245-0.031366764487060314]
hyppo/independence/tests/test_kmerf.py::TestKMERFStat::test_oned[multimodal_independence-0.0-0.31731050786291115]
hyppo/independence/tests/test_kmerf.py::TestKMERFStat::test_oned[multimodal_independence-0.0-0.31731050786291115]
hyppo/ksample/tests/test_ksamp.py::TestKSample::test_rf
  /nix/store/vh3j7r5ryics4am73xy16dn24cd386nf-python3.12-scikit-learn-1.6.1/lib/python3.12/site-packages/sklearn/base.py:1389: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel().
    return fit_method(estimator, *args, **kwargs)

hyppo/kgof/tests/test_density.py::TestNormal::test_log_den[2-2]
  /nix/store/pcymbc18bczllf2kg3x3pwjbvr9makil-python3.12-scipy-1.14.1/lib/python3.12/site-packages/scipy/stats/_multivariate.py:757: RuntimeWarning: covariance is not symmetric positive-semidefinite.
    out = random_state.multivariate_normal(mean, cov, size)

hyppo/ksample/tests/test_mean_embedding.py::TestMeanEmbedding::test_one_frequency[0.0164-0.898]
  /build/source/hyppo/ksample/mean_embedding.py:169: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    stat = float(num_samples * mu**2) / float(sigma)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED hyppo/conditional/tests/test_FCIT.py::TestFCIT::test_null[1-100000--0.16024-0.56139] - AssertionError: 
FAILED hyppo/conditional/tests/test_FCIT.py::TestFCIT::test_alternative[1-100000-89.271754-2.91447597e-12] - AssertionError: 
FAILED hyppo/conditional/tests/test_FCIT.py::TestFCIT::test_alternative[2-100000-161.35165-4.63412957e-14] - AssertionError: 
====== 3 failed, 566 passed, 4 skipped, 273 warnings in 470.74s (0:07:50) ======

Version information

  • OS: NixOS
  • Python Version 3.12
  • Package Version 0.5.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions