jieunbyun / BNS-JT

Reference: Byun, J.-E. and Song, J. (2021). A general framework of Bayesian network for system reliability analysis using junction tree. Reliability Engineering & System Safety, 216, 107952.
MIT License
5 stars 3 forks source link

fix gen_prob #58

Closed dynaryu closed 5 months ago

dynaryu commented 5 months ago

I changed the code so the C should have (1, *) shape, but not sure about the expected result for the test in the test_prod_cpm_sys_and_comps.

jieunbyun commented 5 months ago

Thank you, but now "get_prob" does not work for previously working commands. When "pf = cpm.get_prob( Mnew, [varis['sys']], [0] )" is executed, it gives an error at "assert isinstance(M, Cpm)". When I check what type M has, it shows <class 'BNS_JT.cpm.Cpm'>. Do you have any idea..?

dynaryu commented 5 months ago

Not sure but it works when I tried. Please check test_prod_cpm_sys_and_comps.

p_f = cpm.get_prob(cpms_new, [varis['sys']], [0])
assert p_f == pytest.approx(0.002236, rel=1.0e-3)
jieunbyun commented 5 months ago

Oh I found the issue. When a module is reloaded by importlib, it is assigned a slightly different name, and isinstance becomes confused : (