def setUp(self): from gPy.Examples import asia from gPy.Parameters import CPT from gPy.Models import JFR from agm2 import myBN cpts = [] for cpt in asia: if cpt.child() not in ('Smoking', 'Cancer', 'Bronchitis'): cpts.append(cpt) cpts.append( CPT((asia['Cancer'] * asia['Smoking']).sumout(['Smoking']), child='Cancer')) cpts.append( CPT((asia['Bronchitis'] * asia['Smoking']).sumout(['Smoking']), child='Bronchitis')) self.bn = myBN(cpts) jf = JFR(self.bn.copy(), modify=True) jf.calibrate() self.order = ('Cancer', 'Bronchitis', 'TbOrCa', 'XRay', 'VisitAsia', 'Tuberculosis', 'Dyspnea') self.margs = [] for v in self.order: # these checked to be correct with Netica self.margs.append(jf.var_marginal(v))
def setUp(self): from gPy.Examples import asia from gPy.Parameters import CPT from gPy.Models import JFR from agm2 import myBN cpts = [] for cpt in asia: if cpt.child() not in ("Smoking", "Cancer", "Bronchitis"): cpts.append(cpt) cpts.append(CPT((asia["Cancer"] * asia["Smoking"]).sumout(["Smoking"]), child="Cancer")) cpts.append(CPT((asia["Bronchitis"] * asia["Smoking"]).sumout(["Smoking"]), child="Bronchitis")) self.bn = myBN(cpts) jf = JFR(self.bn.copy(), modify=True) jf.calibrate() self.order = ("Cancer", "Bronchitis", "TbOrCa", "XRay", "VisitAsia", "Tuberculosis", "Dyspnea") self.margs = [] for v in self.order: # these checked to be correct with Netica self.margs.append(jf.var_marginal(v))
def setUp(self): jf = JFR(pedigree.copy(), modify=True) jf.calibrate() self.jf = jf self.g1 = [0.2, 0.3, 0.2, 0.1, 0.1, 0.1] self.g12 = [0.2025, 0.27, 0.225, 0.09, 0.15, 0.0625]
def setUp(self): jf = JFR(pedigree.copy(),modify=True) jf.calibrate() self.jf = jf self.g1 = [0.2, 0.3, 0.2, 0.1, 0.1, 0.1] self.g12 = [0.2025, 0.27, 0.225, 0.09, 0.15, 0.0625]