def main(self, train_scenario_dn:str, test_scenario_dn:str=None): ''' main method Arguments --------- train_scenario_dn:str directory name with ASlib scenario training data test_scenarios_dn:str directory name with ASlib scenario test data (performance data is missing) ''' # Read scenario files scenario = ASlibScenario() scenario.read_scenario(dn=train_scenario_dn) # fit on training data self.fit(scenario=scenario) # Read test files # ASlibScenario is not designed to read partial scenarios # therefore, we have to cheat a bit scenario = ASlibScenario() scenario.read_description(fn=os.path.join(test_scenario_dn,"description.txt")) scenario.read_feature_values(fn=os.path.join(test_scenario_dn,"feature_values.arff")) scenario.read_feature_runstatus(fn=os.path.join(test_scenario_dn,"feature_runstatus.arff")) # predict on test data self.predict(scenario=scenario)
def __init__(self, path): # read the parts of the aslib scenario which are present. This is adapted from # the example here: (in the predict method) # # https://github.com/mlindauer/OASC_starterkit/blob/master/oasc_starterkit/single_best.py scenario = ASlibScenario() scenario.read_description(fn=os.path.join(path,"description.txt")) scenario.read_feature_values(fn=os.path.join(path,"feature_values.arff")) scenario.read_feature_runstatus(fn=os.path.join(path,"feature_runstatus.arff")) scenario.instances = scenario.feature_data.index self.scenario = scenario