def main(args): graph = Graph(args.graph, idify=args.idify, verbose=args.verbosity > 0) if args.verbosity > 0: print('Graph loaded.') searcher = Searcher(graph) if args.verbosity > 0: print('Creating model.') model = searcher.build_model(verbosity=args.verbosity, passes=2, label_qualify=True, order=['mdl_err', 'coverage', 'lex']) if args.verbosity > 0: print('***** Initial model *****') model.print_stats() model.save('{}{}_model'.format(args.output_path, args.graph)) if args.rule_merging: model = model.merge_rules(verbosity=args.verbosity) if args.verbosity > 0: print('***** Model refined with Rm *****') model.print_stats() model.save('{}{}_model_Rm'.format(args.output_path, args.graph)) if args.rule_nesting: model = model.nest_rules(verbosity=args.verbosity) if args.verbosity: print('***** Model refined with Rn *****') model.print_stats() model.save('{}{}_model_Rm_Rn'.format(args.output_path, args.graph))
def test_plant_forest_1(self): ''' Tests that a planting a forest leads to the correct number of correct_assertions and these cover the right number of edges. ''' graph = Graph('test', idify=False, verbose=False) searcher = Searcher(graph) model = searcher.build_model(verbosity=0) rule = Rule(('1927286',), (('6293378', 'out', (('7241965',), ())),)) model.plant_forest(rule) assert(len(rule.correct_assertions) == 1) assert(len(rule.get_edges_covered()) == 6) assert(rule.get_labels_covered() == {('7241965', '36240'), ('7241965', '6555563'), ('7241965', '2415820'), ('7241965', '879961'), ('7241965', '6341376'), ('7241965', '6175574')})
def test_level_1_model_2(self): graph = Graph('test', idify=False, verbose=False) searcher = Searcher(graph) model = searcher.build_model(verbosity=0) assert(model.nest_rules(verbosity=0) == model)
def test_build_model_1(self): graph = Graph('test', verbose=False) searcher = Searcher(graph) m_star = searcher.build_model(verbosity=0)