Esempio n. 1
0
def main():
    file_name_labeled_examples = 'D:\\KUL\\KUL MAI\\Masterproef\\data\\ACE-examples-data\\ace\\mach\\keys\\mach.kb'
    file_name_settings = 'D:\\KUL\\KUL MAI\\Masterproef\\data\\ACE-examples-data\\ace\\mach\\keys\\mach.s'
    file_name_background = 'D:\\KUL\\KUL MAI\\Masterproef\\data\\ACE-examples-data\\ace\\mach\\keys\mach.bg'

    use_clausedb = True
    use_mle = False

    debug_printing_example_parsing = False
    debug_printing_tree_building = False
    debug_printing_tree_pruning = False
    debug_printing_program_conversion = False
    debug_printing_get_classifier = False
    debug_printing_classification = True

    parsed_settings = KeysSettingsParser().parse(file_name_settings)

    treebuilder_type = TreeBuilderType.DETERMINISTIC

    # background_knowledge = parse_background_knowledge(file_name_background)

    if use_clausedb:
        internal_ex_format = InternalExampleFormat.CLAUSEDB
    else:
        internal_ex_format = InternalExampleFormat.SIMPLEPROGRAM

    run_keys(file_name_labeled_examples, parsed_settings, internal_ex_format, treebuilder_type,
             fname_background_knowledge=file_name_background,
             debug_printing_example_parsing=debug_printing_example_parsing,
             debug_printing_tree_building=debug_printing_tree_building,
             debug_printing_tree_pruning=debug_printing_tree_pruning,
             debug_printing_program_conversion=debug_printing_program_conversion,
             debug_printing_get_classifier=debug_printing_get_classifier,
             debug_printing_classification=debug_printing_classification
             )
Esempio n. 2
0
def main():
    project_dir = '/home/joschout/Repos/tilde'

    dataset_name = 'mach'
    data_dir = os.path.join(project_dir, 'ACE-examples-data', dataset_name)

    keys_or_examples = 'keys'

    file_name_settings = os.path.join(data_dir, keys_or_examples, dataset_name + '.s')
    file_name_background = os.path.join(data_dir, keys_or_examples, dataset_name + '.bg')
    file_name_labeled_examples = os.path.join(data_dir, keys_or_examples, dataset_name + '.kb')

    use_clausedb = True
    use_mle = False

    debug_printing_example_parsing = False
    debug_printing_tree_building = False
    debug_printing_tree_pruning = False
    debug_printing_program_conversion = False
    debug_printing_get_classifier = False
    debug_printing_classification = True

    parsed_settings = KeysSettingsParser().parse(file_name_settings)

    treebuilder_type = TreeBuilderType.DETERMINISTIC

    # background_knowledge = parse_background_knowledge(file_name_background)

    if use_clausedb:
        internal_ex_format = InternalExampleFormat.CLAUSEDB
    else:
        internal_ex_format = InternalExampleFormat.SIMPLEPROGRAM

    run_keys(file_name_labeled_examples, parsed_settings, internal_ex_format, treebuilder_type,
             fname_background_knowledge=file_name_background,
             debug_printing_example_parsing=debug_printing_example_parsing,
             debug_printing_tree_building=debug_printing_tree_building,
             debug_printing_tree_pruning=debug_printing_tree_pruning,
             debug_printing_program_conversion=debug_printing_program_conversion,
             debug_printing_get_classifier=debug_printing_get_classifier,
             debug_printing_classification=debug_printing_classification
             )
    internal_ex_format = InternalExampleFormat.CLAUSEDB
else:
    internal_ex_format = InternalExampleFormat.SIMPLEPROGRAM

times = []
#
for i in range(0, 10):
    #
    start = timeit.default_timer()

    run_keys(
        file_name_labeled_examples,
        parsed_settings,
        internal_ex_format,
        treebuilder_type,
        debug_printing_example_parsing=debug_printing_example_parsing,
        debug_printing_tree_building=debug_printing_tree_building,
        debug_printing_tree_pruning=debug_printing_tree_pruning,
        debug_printing_program_conversion=debug_printing_program_conversion,
        debug_printing_get_classifier=debug_printing_get_classifier,
        debug_printing_classification=debug_printing_classification)
    #     gc.collect()
    end = timeit.default_timer()

    # print("time", end - start)

    times.append(end - start)
# enable_printouts()
print("times:", times)
print("average duration:", statistics.mean(times), "seconds")
plt2.clf()
Esempio n. 4
0
file_name_labeled_examples = os.path.join(data_dir, dataset_name + ".kb")
file_name_settings = os.path.join(data_dir, dataset_name + ".s")
file_name_background = os.path.join(data_dir, dataset_name + ".bg")

debug_printing_example_parsing = True
debug_printing_tree_building = True
debug_printing_tree_pruning = True
debug_printing_program_conversion = True
debug_printing_get_classifier = True
debug_printing_classification = True

parsed_settings = KeysSettingsParser().parse(file_name_settings)

treebuilder_type = TreeBuilderType.MLEDETERMINISTIC

internal_ex_format = InternalExampleFormat.CLAUSEDB

run_keys(file_name_labeled_examples,
         parsed_settings,
         internal_ex_format,
         treebuilder_type,
         fname_background_knowledge=file_name_background,
         stop_criterion_handler=StopCriterionMinimalCoverage(4),
         debug_printing_example_parsing=debug_printing_example_parsing,
         debug_printing_tree_building=debug_printing_tree_building,
         debug_printing_tree_pruning=debug_printing_tree_pruning,
         debug_printing_program_conversion=debug_printing_program_conversion,
         debug_printing_get_classifier=debug_printing_get_classifier,
         debug_printing_classification=debug_printing_classification)