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)
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))
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) ]
def get_symmetric_implication(imp): return Implication(get_symmetric_attribute_set(imp.premise), get_symmetric_attribute_set(imp.conclusion))