def before_train(self, logs=None): """Call before_train of the managed callbacks.""" super().before_train(logs) """Be called before the training process.""" hpo_result = FileOps.load_pickle( FileOps.join_path(self.trainer.local_output_path, 'best_config.pickle')) logging.info("loading stage1_hpo_result \n{}".format(hpo_result)) feature_interaction_score = hpo_result['feature_interaction_score'] print('feature_interaction_score:', feature_interaction_score) sorted_pairs = sorted(feature_interaction_score.items(), key=lambda x: abs(x[1]), reverse=True) if ModelConfig.model_desc: fis_ratio = ModelConfig.model_desc["custom"]["fis_ratio"] else: fis_ratio = 1.0 top_k = int(len(feature_interaction_score) * min(1.0, fis_ratio)) self.selected_pairs = list(map(lambda x: x[0], sorted_pairs[:top_k])) # add selected_pairs setattr(ModelConfig.model_desc['custom'], 'selected_pairs', self.selected_pairs)
def before_train(self, logs=None): """Call before_train of the managed callbacks.""" super().before_train(logs) """Be called before the training process.""" hpo_result = FileOps.load_pickle(FileOps.join_path( self.trainer.local_output_path, 'best_config.pickle')) logging.info("loading stage1_hpo_result \n{}".format(hpo_result)) self.selected_pairs = hpo_result['feature_interaction'] logging.info('feature_interaction:', self.selected_pairs) # add selected_pairs setattr(ModelConfig.model_desc['custom'], 'selected_pairs', self.selected_pairs)