def method_param_selector(callback, uniquekey): import itertools from constants import methods s = [ methods.preprocessing, methods.segmentation, methods.activity_fetcher, methods.feature_extraction, methods.classifier ] permut = list(itertools.product(*s)) allpool = [] for item in permut: func = Data('Functions') func.uniquekey = uniquekey func.preprocessor = createFunction(item[0]) func.segmentor = createFunction(item[1]) func.activityFetcher = createFunction(item[2]) func.featureExtractor = createFunction(item[3]) func.classifier = createFunction(item[4]) func.combiner = createFunction(methods.combiner[0]) func.classifier_metric = createFunction(methods.classifier_metric[0]) func.event_metric = createFunction(methods.classifier_metric[0]) func.shortrunname = '' for k in func.__dict__: obj = func.__dict__[k] if isinstance(obj, MyTask): obj.func = func func.shortrunname += obj.shortname() + '_' optl = OptLearn(func, callback) allpool.append(optl) # break success, fail = run(allpool, True) bestJobscore = success[0].result['optq']['q'] bestJob = success[0] for job in success: if (bestJobscore > job.result['optq']['q']): bestJobscore = job.result['optq']['q'] bestJob = job return bestJob
{ 'gamma': 1}, { 'C': 100.}, {'decision_function_shape':'ovr'} ]}, {'method': lambda: classifier.MySKLearn.UAR_SVM2(), 'params': [ {'kernel': 'linear'}, {'gamma': 1}, {'C':100.}, {'decision_function_shape':'ovr'} ]}, {'method': lambda: classifier.MySKLearn.UAR_DecisionTree(), 'params': [ ]}, ] methods.classifier_metric = [ {'method': lambda: metric.classical.Accuracy()}, #{'method': lambda: Accuracy()}, ] methods.event_metric = [ # {'method': lambda: metric.Accuracy.Accuracy()}, #{'method': lambda: Accuracy()}, ] methods.activity_fetcher = [ {'method': lambda: activity_fetcher.MaxActivityFetcher.MaxActivityFetcher()}, # {'method': lambda: activity_fetcher.CookActivityFetcher.CookActivityFetcher()} ] methods.combiner = [ {'method':lambda: combiner.SimpleCombiner.EmptyCombiner2()}, # {'method':lambda: combiner.SimpleCombiner.SimpleCombiner()}, # {'method':lambda: combiner.SimpleCombiner.EmptyCombiner()},