Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def train(self):
lightwood.config.config.CONFIG.USE_CUDA = self.transaction.lmd['use_gpu']
lightwood.config.config.CONFIG.CACHE_ENCODED_DATA = not self.transaction.lmd['force_disable_cache']
lightwood.config.config.CONFIG.SELFAWARE = self.transaction.lmd['use_selfaware_model']
if self.transaction.lmd['model_order_by'] is not None and len(self.transaction.lmd['model_order_by']) > 0:
self.transaction.log.debug('Reshaping data into timeseries format, this may take a while !')
train_df = self._create_timeseries_df(self.transaction.input_data.train_df)
test_df = self._create_timeseries_df(self.transaction.input_data.test_df)
self.transaction.log.debug('Done reshaping data into timeseries format !')
else:
train_df = self.transaction.input_data.train_df
test_df = self.transaction.input_data.test_df
lightwood_config = self._create_lightwood_config()
if self.transaction.lmd['skip_model_training'] == True:
self.predictor = lightwood.Predictor(load_from_path=os.path.join(CONFIG.MINDSDB_STORAGE_PATH, self.transaction.lmd['name'] + '_lightwood_data'))
else: