# Treedy: A Heuristic for Counting and Sampling Subsets

arXiv: https://arxiv.org/abs/1309.6851 · HTML: https://mlsanity.com/paper/1309.6851/

## Key facts

- Cited by 1 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 26 Sep 2013.

## Built on by (most cited first, 1 of 1)

- [Scaling Up Bayesian DAG Sampling](https://mlsanity.com/paper/2510.25254/) (2025)

## Abstract (arXiv)

Consider a collection of weighted subsets of a ground set N. Given a query subset Q of N, how fast can one (1) find the weighted sum over all subsets of Q, and (2) sample a subset of Q proportionally to the weights? We present a tree-based greedy heuristic, Treedy, that for a given positive tolerance d answers such counting and sampling queries to within a guaranteed relative error d and total variation distance d, respectively. Experimental results on artificial instances and in application to Bayesian structure discovery in Bayesian networks show that approximations yield dramatic savings in running time compared to exact computation, and that Treedy typically outperforms a previously proposed sorting-based heuristic.
