aboutsummaryrefslogtreecommitdiff
path: root/beliefs/factors
diff options
context:
space:
mode:
authorCathy Yeh <cathy@driver.xyz>2017-12-12 21:28:26 -0800
committerCathy Yeh <cathy@driver.xyz>2017-12-13 18:45:03 -0800
commit10f5c49ea6767f54d59f88eb4064bb4959d14c6b (patch)
tree7ce485c2e678c593fd474537e3a125cd783c79cc /beliefs/factors
parentb3b8bb68d6d590175a07dfc4022b4903d63222e5 (diff)
downloadbeliefs-10f5c49ea6767f54d59f88eb4064bb4959d14c6b.tar.gz
beliefs-10f5c49ea6767f54d59f88eb4064bb4959d14c6b.tar.bz2
beliefs-10f5c49ea6767f54d59f88eb4064bb4959d14c6b.zip
implement explicit factor methods for compute_pi_agg and compute_lambda_msg_to_parent in Node
Diffstat (limited to 'beliefs/factors')
-rw-r--r--beliefs/factors/discrete_factor.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/beliefs/factors/discrete_factor.py b/beliefs/factors/discrete_factor.py
index da8e6bf..b75da28 100644
--- a/beliefs/factors/discrete_factor.py
+++ b/beliefs/factors/discrete_factor.py
@@ -86,9 +86,16 @@ class DiscreteFactor:
right = copy.deepcopy(other)
left.add_new_variables_from_other_factor(right)
right.add_new_variables_from_other_factor(left)
+ print('var', left.variables)
+ print(left.cardinality)
+ print(left.values)
+ print('var', right.variables)
+ print(right.cardinality)
+ print(right.values)
# reorder variables in right factor to match order in left
source_axes = list(range(right.values.ndim))
+ print('source_axes', source_axes)
destination_axes = [right.variables.index(var) for var in left.variables]
right.variables = [right.variables[idx] for idx in destination_axes]