Esempio n. 1
0
 def test_all(self):
     basis = [
         Implication(set([acute, right]), set([equilateral, isosceles])),
         Implication(set([equilateral]), set([isosceles, acute]))
     ]
     session = self.e.create_session()
     self.assertEqual(len(session.context.objects), 3)
Esempio n. 2
0
 def test_all(self):
     basis = [
             Implication({acute, right}, {equilateral, isosceles}),
             Implication({equilateral}, {isosceles, acute})
             ]
     expert = GenericExpert(basis)
     exploration = AttributeExploration(self.db, expert)
     expert.explore(exploration)
     self.assertEqual(len(self.db._cxt.objects), 6)
     self.assertEqual(len(self.db.base), len(basis))
Esempio n. 3
0
def generate_background_implications(attributes):
    return [
        Implication(set([x, y]), set([z])) for x in attributes
        for y in attributes for z in attributes
        if (x.left == z.left and x.right == y.left and y.right == z.right) or (
            x.left == z.left and x.right == y.right and y.left == z.right) or (
                x.left == y.left and x.right == z.left and y.right == z.right)
    ]
Esempio n. 4
0
def get_symmetric_implication(imp):
    return Implication(get_symmetric_attribute_set(imp.premise),
                       get_symmetric_attribute_set(imp.conclusion))