def train_autonas(ui): train_nas = Trainer() if ui.mode == 'train': if ui.optimize == 'pso': print("LOOKS GOOD - pso") train_nas.pso_train(ui) elif ui.optimize == 'aco': print("LOOKS GOOD - aco ") train_nas.aco_train(ui) elif ui.optimize == 'autokeras' or ui.optimize == 'automodel': train_nas.autokeras_train(ui) if ui.mode == 'pretrain': # custom_model will be used within pre_train featuresTrain, featuresVal, trainY, testY = train_nas.pre_train(ui) if ui.second_model: print("Running multiple classifiers") train_nas.multiple_classifiers(featuresVal, testY, ui) if ui.tune: # tuning in this context means fine tuning of hyper parameters of chosen secondary model # tuning of inner layers of pre-trained models also to be implemented print("Tuning the secondary model") train_nas.tune_secondary_model(featuresTrain, featuresVal, trainY, testY, ui) if ui.mode == 'hybrid': # custom_model will be used within pre_train print("LOOKS GOOD - hybrid") train_nas.hybrid(ui) if ui.mode == 'ensemble': print("LOOKS GOOD - ensemble ") ensemble(ui) if ui.mode == 'super_stacker': print("LOOKS GOOD - super_stacker ") super_stacker(ui) return
import matplotlib.pyplot as plt from variables import multi_step_lags, test_len, full_len import os root_path = os.path.dirname(os.path.abspath('__file__')) import sys sys.path.append(root_path) from ensembler import ensemble # Set the project parameters ORIGINAL = 'XianyangRunoff1951-2018(1953-2018).xlsx' STATION = 'Xianyang' DECOMPOSER = 'ssa' PREDICTOR = 'esvr' # esvr or gbrt or lstm PREDICT_PATTERN = 'multi_step_1_month_forecast' # hindcast or forecast ensemble( root_path=root_path, original_series=ORIGINAL, station=STATION, decomposer=DECOMPOSER, multi_step_llags_dict=variables['lags_dict'], predictor=PREDICTOR, predict_pattern=PREDICT_PATTERN, test_len=test_len, full_len=full_len, ) plt.show()