def align(options, path, included): ''' Display side by side. ''' actual = get_src_file(path) if is_simple_inclusion(options, included, actual): return included = included.rstrip('\n').split('\n') actual = actual.rstrip('\n').split('\n') matches = [Match(0, 0, 0)] + \ SequenceMatcher(a=included, b=actual).get_matching_blocks() result = [] diffs_found = False fmt = '{{0}}|{{1:{}}}|{{2}}'.format(max([len(x) for x in included])) for i in range(len(matches) - 1): diffs_found |= align_one(result, options, fmt, included, actual, matches[i], matches[i + 1]) if options['names_only']: if diffs_found: print(path) elif diffs_found or options['verbose']: print('\n-- {}'.format(path)) for r in result: print(r)
def __init__(self,src_file_index,bounds): self.model = XGBRFRegressor() self.model_name = "XGBRFRegressor" self.src = util.get_src_file(src_file_index=src_file_index) self.lower_bounds = bounds["lower_bounds"] self.upper_bounds = bounds["upper_bounds"] self.with_rain = False self.optimization_methods = optimization_methods self.num_iterations = 200 self.results = {} self.result_save_path = 'optimization_result/with_rain_'+str(self.with_rain)+'/'+self.src.split('.')[0].split('/')[-1]+'/' self.optimization() self.save_optimization_result()
def __init__(self, src_file_index, model_index, is_ensemble=False, with_rain=False, method='bayesian_optimization'): self.set_bounds(lower_bounds=[36, 2], upper_bounds=[60, 30]) self.model, self.model_name = util.get_model(is_ensemble=is_ensemble, model_index=model_index) self.src = util.get_src_file(src_file_index=src_file_index) self.method = method self.num_iterations = 200 self.with_rain = with_rain self.results = None
def __init__(self, src_file_index, model_index, bounds): self.src = util.get_src_file(src_file_index=src_file_index) self.model, self.model_name = util.get_model(is_ensemble=True, model_index=model_index) self.lower_bounds = bounds["lower_bounds"] self.upper_bounds = bounds["upper_bounds"] self.with_rain = False self.optimization_methods = ["random_search", 'bayesian_optimization'] self.num_iterations = 200 self.results = {} self.result_save_path = 'optimization_result/with_rain_' + str( self.with_rain) + '/' + self.src.split('.')[0].split('/')[-1] + '/' self.optimization() self.save_optimization_result()