Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.datasets`.make_spd_matrix

sklearn.datasets.make_spd_matrix(n_dim, *, random_state=None)

  Generate a random symmetric, positive-definite matrix.

  Read more in the User Guide.

  Parameters:
    n_dim int

      The matrix dimension.

    random_state int, RandomState instance or None, default=None

      Determines random number generation for dataset creation. Pass an int for reproducible output across multiple function calls. See Glossary.

  Returns:
    X ndarray of shape (n_dim, n_dim)

      The random symmetric, positive-definite matrix.

  See also

  `make_sparse_spd_matrix`

    Generate a sparse symmetric definite positive matrix.