model_average.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:skggm 作者: skggm 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号