def _fully_random_weights(n_features, lam_scale, prng):
"""Generate a symmetric random matrix with zeros along the diagonal."""
weights = np.zeros((n_features, n_features))
n_off_diag = int((n_features ** 2 - n_features) / 2)
weights[np.triu_indices(n_features, k=1)] =\
0.1 * lam_scale * prng.randn(n_off_diag) + (0.25 * lam_scale)
weights[weights < 0] = 0
weights = weights + weights.T
return weights
评论列表
文章目录