示例#1
0
from classifier.Cleaner.Cleaner import Cleaner
from classifier.Plotter.Plotter import Plotter
import sys
from termcolor import colored, cprint

modules_dict = {}
modules_dict['Preprocessing'] = Preprocessing
modules_dict['CorrMaxtrix'] = CorrMaxtrix
modules_dict['GraphCreator'] = GraphCreator
modules_dict['Sub2Vec'] = Sub2Vec
modules_dict['classifier'] = classifier
modules_dict['Cleaner'] = Cleaner
# modules_dict['Plotter'] = Plotter

pipeline = []
config = config_class(sys.argv[1])
config = config.getConfig()

num_of_runs = int(config.get("DEFAULT", "num_of_runs"))

for module in config.sections():
    if modules_dict.get(module) and module != 'DEFAULT':
        pipeline.append(modules_dict.get(module)())

#running test x times
for i in range(num_of_runs):
    print(
        colored("---------------------------------------------------------",
                'yellow',
                attrs=['bold']))
    print("run number {}".format(i))
示例#2
0
modules_dict['CorrMaxtrix'] = CorrMaxtrix
modules_dict['GraphCreator'] = GraphCreator
modules_dict['Sub2Vec'] = Sub2Vec
modules_dict['classifier'] = classifier
modules_dict['Plotter'] = Plotter

pipeline = []

# add config files from directory
config_files = []
for filename in os.listdir(sys.argv[1]):
    if filename.endswith(".ini"):
        config_files.append(sys.argv[1] + os.sep + filename)

for config_file in config_files:
    config = config_class(config_file)
    config = config.getConfig()
    print("__________________________________")
    print("running {}".format(config_file))
    print("__________________________________")
    for module in config.sections():
        if modules_dict.get(module) and module != 'DEFAULT':
            pipeline.append(modules_dict.get(module)())
    #running test x times
    num_of_runs = int(config.get("DEFAULT", "num_of_runs"))
    for i in range(num_of_runs):
        print("run number {}".format(i))
        for element in pipeline:
            print("Initializing {}".format(element.__class__.__name__))
            element.setup()