def handle(self, *args, **options): #args = parse_args(args) setup_logging(options['loglevel']) script_config = LSTMHyperoptTrainingScriptConfig(args.config_file) _logger.debug("Starting training an LSTM with {} configuration".format(args.config_file)) since_date = args.since_date.split('-') _logger.debug("since_date parameter is {} ".format(since_date)) which_minute = int(args.which_minute) _logger.debug("which_minute parameter is {} ".format(which_minute)) if which_minute <= 0 : which_minutes = range(60) else: which_minutes = [which_minute] if not os.path.exists(script_config.output_models_path): os.makedirs(script_config.output_models_path) if not os.path.exists(script_config.output_results_path): os.makedirs(script_config.output_results_path) tic = time.time() train_lstm(script_config,since_date,which_minutes) toc = time.time() _logger.debug("Training has ended, took {} seconds overall".format(toc-tic))
def handle(self, *args, **options): # reading parameters self.config_file = os.path.join(settings.CONFIG_DIR, options['config_file']) self.log_success('Config file read from parameters {}'.format( self.config_file)) script_config = LSTMHyperoptTrainingScriptConfig(self.config_file) self.log_success('Script-config: {}'.format(script_config)) try: model_package_path = options['model_package_path'] if model_package_path == '': model_package_path = None except Exception as e: self.log_success( 'Error trying to read model_package_path parameter : {}'. format(e)) self.log_success( 'Model package file to call predict_lstm is {}'.format( model_package_path)) try: future_steps = int(options['future_steps']) except Exception as e: self.log_success( 'Error trying to read future_steps parameter : {}'.format(e)) self.log_success( 'Future steps to call predict_lstm is {}'.format(future_steps)) try: step_mins = int(options['step_mins']) except Exception as e: self.log_success( 'Error trying to read step_mins parameter : {}'.format(e)) self.log_success('Each step is {} minutes'.format(step_mins)) # starting the predicction process self.predict_lstm(script_config, model_package_path, future_steps, step_mins)
def handle(self, *args, **options): self.config_file = os.path.join(settings.CONFIG_DIR, options['config_file']) self.log_success('Config file read from parameters {}'.format( self.config_file)) since_date = options['since_date'].split('-') self.log_success('Since date argument {}'.format(since_date)) which_minute = int(options['which_minute']) self.log_success('which_minute argument {}'.format(which_minute)) if which_minute <= 0: which_minutes = range(60) else: which_minutes = [which_minute] script_config = LSTMHyperoptTrainingScriptConfig(self.config_file) self.log_success('Script-config: {}'.format(script_config)) self.train_lstm(script_config, since_date, which_minutes)
def handle(self, *args, **options): # parameter parsing self.config_file = os.path.join(settings.CONFIG_DIR, options['config_file']) self.log_success('Config file read from parameters {}'.format( self.config_file)) since_date = options['since_date'].split('-') self.log_success('Since date argument {}'.format(since_date)) which_minute = int(options['which_minute']) self.log_success('which_minute argument {}'.format(which_minute)) if which_minute <= 0: # if we pass negative values, we choose to use the whole hour which_minutes = range(60) else: which_minutes = [which_minute] # instantiate the configuration script_config = LSTMHyperoptTrainingScriptConfig(self.config_file) self.log_success('Script-config: {}'.format(script_config)) # call the training process self.train_lstm(script_config, since_date, which_minutes)
def main(args): """Main entry point allowing external calls Args: args ([str]): command line parameter list """ args = parse_args(args) setup_logging(args.loglevel) script_config = LSTMHyperoptTrainingScriptConfig(args.config_file) _logger.debug("Starting training an LSTM with {} configuration".format(args.config_file)) if not os.path.exists(script_config.output_models_path): os.makedirs(script_config.output_models_path) if not os.path.exists(script_config.output_results_path): os.makedirs(script_config.output_results_path) tic = time.time() train_lstm(script_config) toc = time.time() _logger.debug("Training has ended, took {} seconds overall".format(toc-tic))