File: test_arpack.py

package info (click to toggle)
scikit-learn 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,280 kB
  • sloc: python: 184,491; cpp: 5,783; ansic: 854; makefile: 307; sh: 45; javascript: 1
file content (16 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import pytest
from numpy.testing import assert_allclose

from sklearn.utils import check_random_state
from sklearn.utils._arpack import _init_arpack_v0


@pytest.mark.parametrize("seed", range(100))
def test_init_arpack_v0(seed):
    # check that the initialization a sampling from an uniform distribution
    # where we can fix the random state
    size = 1000
    v0 = _init_arpack_v0(size, seed)

    rng = check_random_state(seed)
    assert_allclose(v0, rng.uniform(-1, 1, size=size))