math.py 文件源码

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

项目:2020plus 作者: KarchinLab 项目源码 文件源码
def max_shannon_entropy(n):
    """Returns max possible entropy given "n" mutations.

    The maximum possible entropy is the entropy of the
    uniform distribution. The uniform distribution has
    entropy equal to log(n) (I will use base 2).

    Parameters
    ----------
    n : int
        total mutation counts

    Returns
    -------
    max possible shannon entropy in bits
    """
    if n <= 0:
        return 0.
    return float(np.log2(n))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号