arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1906.11700cs.DS
收藏

从分类分布修改和抽样的有效算法

Efficient algorithms for modifying and sampling from a categorical distribution

Daniel Tang

摘要:

概率程序设计语言和其他机器学习应用通常需要从分类分布生成样本,其中$n$类别中的每一个的概率被指定为参数。如果参数是超参数,则需要修改它们,然而,分类分布的当前实现需要$\mathcal{O}(n)$时间来修改参数。如果$n$很大,并且经常修改参数,则这可能会变得令人望而却步。在这里,我们提出的见解,霍夫曼树是一个有效的数据结构,用于表示分类分布和算法生成样本,以及添加,删除和修改类别在$\mathcal{O}(\log(n))$时间。我们证明了从分布中采样的时间在实践中仍然在理论最优值的百分之几以内。相同的算法在计算效率很重要的自适应霍夫曼编码的上下文中也可以是有用的。

英文摘要:

Probabilistic programming languages and other machine learning applications often require samples to be generated from a categorical distribution where the probability of each one of $n$ categories is specified as a parameter. If the parameters are hyper-parameters then they need to be modified, however, current implementations of categorical distributions take $\mathcal{O}(n)$ time to modify a parameter. If $n$ is large and the parameters are being frequently modified, this can become prohibitive. Here we present the insight that a Huffman tree is an efficient data structure for representing categorical distributions and present algorithms to generate samples as well as add, delete and modify categories in $\mathcal{O}(\log(n))$ time. We demonstrate that the time to sample from the distribution remains, in practice, within a few percent of the theoretical optimal value. The same algorithm may also be useful in the context of adaptive Huffman coding where computational efficiency is important.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑