I'm using the scipy.sparse.random function to generate random sparse matrices with m,n > 1000, a given density and my upstream programs work:
import numpy
from scipy import sparse
from numpy.random import default_rng
numpy.random.seed(41)
S = sparse.random(m, n, density=0.25, format='csr')
However, when using the numpy.random.default_rng function, the upstream programs don't work:
rng = default_rng(seed=41)
S = sparse.random(m, n, density=0.25, format='csr', random_state=rng)
Any ideas why this should be?
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.random.html
Aucun commentaire:
Enregistrer un commentaire