Exemplo n.º 1
0
 def setUp(self):
     self.bayesian_model = BayesianModel([('A', 'J'), ('R', 'J'),
                                          ('J', 'Q'), ('J', 'L'),
                                          ('G', 'L')])
     cpd_a = TabularCPD('A', 2, [[0.2], [0.8]])
     cpd_r = TabularCPD('R', 2, [[0.4], [0.6]])
     cpd_j = TabularCPD('J', 2,
                        [[0.9, 0.6, 0.7, 0.1], [0.1, 0.4, 0.3, 0.9]],
                        ['R', 'A'], [2, 2])
     cpd_q = TabularCPD('Q', 2, [[0.9, 0.2], [0.1, 0.8]], ['J'], [2])
     cpd_l = TabularCPD('L', 2,
                        [[0.9, 0.45, 0.8, 0.1], [0.1, 0.55, 0.2, 0.9]],
                        ['G', 'J'], [2, 2])
     cpd_g = TabularCPD('G', 2, [[0.6], [0.4]])
     self.bayesian_model.add_cpds(cpd_a, cpd_g, cpd_j, cpd_l, cpd_q, cpd_r)
     self.sampling_inference = BayesianModelSampling(self.bayesian_model)
     self.markov_model = MarkovModel()
Exemplo n.º 2
0
 def test_init(self):
     with self.assertRaises(TypeError):
         BayesianModelSampling(self.markov_model)