random
random
¤
RandomBinaryTree(num_variables, *, depth=None, num_repetitions=1, seed=42)
¤
Construct a RG with random binary trees.
See
Random sum-product networks: A simple but effective approach to probabilistic deep learning. Robert Peharz, Antonio Vergari, Karl Stelzner, Alejandro Molina, Xiaoting Shao, Martin Trapp, Kristian Kersting, Zoubin Ghahramani. UAI 2019.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_variables
|
int
|
The number of variables in the RG. |
required |
depth
|
int
|
The depth of the binary tree. If None, the maximum possible depth is used. |
None
|
num_repetitions
|
int
|
The number of repetitions of binary trees (degree of root). |
1
|
seed
|
int
|
The seed to initialize the random state. |
42
|
Returns:
| Name | Type | Description |
|---|---|---|
RegionGraph |
RegionGraph
|
A randomized binary tree region graph. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If either the number of variables or number of reptitions are not positive. |
ValueError
|
If the given depth is either negative or greate than the maximum allowed one. |
Source code in cirkit/templates/region_graph/algorithms/random.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |