bayesian-belief-networks
bayesian-belief-networks copied to clipboard
Test not working
Ok i just noticed the last commit was some time ago.
[ erik@halberstadt:~/bayes_test/bayesian-belief-networks ] $ git show
commit 511856960e87e070748db5bac7d59ddd1bb5b1e0
Author: Neville Newey <[email protected]>
Date: Sat Aug 9 10:59:26 2014 -0700
If anyone is still out there I tried running the unit tests and they failed in a way that looks important.
[ erik@halberstadt:~/bayes_test/bayesian-belief-networks ] $ PYTHONPATH=. py.test bayesian/test
========================================================= test session starts ==========================================================
platform darwin -- Python 2.7.10, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /Users/erik/bayes_test/bayesian-belief-networks, inifile:
collected 98 items
bayesian/test/test_bbn.py ...........F......
bayesian/test/test_examples.py ......
bayesian/test/test_factor_graph_verify.py .........
bayesian/test/test_gaussian.py ............
bayesian/test/test_gaussian_bayesian_network.py .....
bayesian/test/test_gbn_examples.py ..
bayesian/test/test_graph.py ..........................
bayesian/test/test_linear_algebra.py .......
bayesian/test/test_persistance.py .
bayesian/test/test_undirected_graph.py .
bayesian/test/examples/bbns/test_cancer.py ......
bayesian/test/examples/bbns/test_earthquake.py .
bayesian/test/examples/bbns/test_huang_darwiche.py .
bayesian/test/examples/bbns/test_monty_hall.py ..
bayesian/test/examples/factor_graphs/test_earthquake_fg.py .
=============================================================== FAILURES ===============================================================
_____________________________________________________ TestBBN.test_assign_clusters _____________________________________________________
self = <test_bbn.TestBBN instance at 0x1025a7878>, huang_darwiche_jt = <bayesian.bbn.JoinTree object at 0x1025b7390>
huang_darwiche_dag = <bayesian.bbn.BBN object at 0x102597d50>
def test_assign_clusters(self, huang_darwiche_jt, huang_darwiche_dag):
# NOTE: This test will fail sometimes as assign_clusters
# is currently non-deterministic, we should fix this.
bbn_nodes = dict([(node.name, node) for node in
huang_darwiche_dag.nodes])
assignments = huang_darwiche_jt.assign_clusters(huang_darwiche_dag)
jt_cliques = dict([(node.name, node) for node
in huang_darwiche_jt.clique_nodes])
# Note that these assignments are slightly different
# to the ones in H&D. In their paper they never
# give a full list of assignments so we will use
# these default deterministic assignments for the
# test. These are assumed to be a valid assignment
# as all other tests pass.
assert [] == assignments[jt_cliques['Clique_ADE']]
assert [bbn_nodes['f_f']] == assignments[jt_cliques['Clique_DEF']]
assert [bbn_nodes['f_h']] == assignments[jt_cliques['Clique_EGH']]
> assert [bbn_nodes['f_a'], bbn_nodes['f_c']] == \
assignments[jt_cliques['Clique_ACE']]
E assert [<BBNNode f_a...(['a', 'c'])>] == [<BBNNode f_c (['a', 'c'])>]
E At index 0 diff: <BBNNode f_a (['a'])> != <BBNNode f_c (['a', 'c'])>
E Left contains more items, first extra item: <BBNNode f_c (['a', 'c'])>
E Use -v to get the full diff
bayesian/test/test_bbn.py:543: AssertionError
================================================= 1 failed, 97 passed in 0.78 seconds ==================================================
This is a known issue and on the todo list. See these comments in the test code:
NOTE: This test will fail sometimes as assign_clusters
# is currently non-deterministic, we should fix this.