This documentation is for scikit-learn version 0.11-gitOther versions

Citing

If you use the software, please consider citing scikit-learn.

This page

8.4.2.11. sklearn.datasets.make_sparse_spd_matrix

sklearn.datasets.make_sparse_spd_matrix(dim=1, alpha=0.95, norm_diag=False, smallest_coef=0.1, largest_coef=0.9, random_state=None)

Generate a sparse symetric definite positive matrix.

Parameters :

dim: integer, optional (default=1) :

The size of the random (matrix to generate.

alpha: float between 0 and 1, optional (default=0.95) :

The probability that a coefficient is non zero (see notes).

random_state : int, RandomState instance or None, optional (default=None)

If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

Returns :

prec: array of shape = [dim, dim] :

Notes

The sparsity is actually imposed on the cholesky factor of the matrix. Thus alpha does not translate directly into the filling fraction of the matrix itself.