From 1721fb343b36e3e87c256807c6ee70021670bbef Mon Sep 17 00:00:00 2001 From: hjwilli Date: Wed, 2 Dec 2020 16:29:15 -0500 Subject: [PATCH] docker prod volume paths, log verbosity mount /data/recommenders volume to production builds adjust recommender log verbosity Former-commit-id: fc800d7e7fa67973ee1ffbf1c31e7b54ba42264c --- ai/recommender/base.py | 7 ++++--- ai/recommender/surprise_recommenders.py | 17 +++++++++-------- docker-compose-production.yml | 1 + 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ai/recommender/base.py b/ai/recommender/base.py index 4ecb0e900..9e71a0111 100644 --- a/ai/recommender/base.py +++ b/ai/recommender/base.py @@ -179,22 +179,23 @@ def _train_empty_rec(self, # load serialized rec, or initialize from the given # knowledgebase logger.info(f"load_serialized_rec='{load_serialized_rec}'") + logger.info(f"self.serialized_rec_path='{self.serialized_rec_path}'") if load_serialized_rec == "always": if not os.path.exists(self.serialized_rec_path): raise ValueError(f"load_serialized_rec='{load_serialized_rec}'" " but cannot load serialized recommender:" - " '{self.serialized_rec_path}'") + f" '{self.serialized_rec_path}'") self.load(self.serialized_rec_path, knowledgebase_results) elif load_serialized_rec == "if_exists": if os.path.exists(self.serialized_rec_path): logger.info(f"Loading serialized recommender:" - " {self.serialized_rec_path}") + f" '{self.serialized_rec_path}'") self.load(self.serialized_rec_path, knowledgebase_results) else: logger.warn(f"Not loading serialized recommender, file does " - "not exist: {self.serialized_rec_path}") + f"not exist: '{self.serialized_rec_path}'") if knowledgebase_results is not None: logger.info(f"Initializing new recommender from provided " "knowledgebase") diff --git a/ai/recommender/surprise_recommenders.py b/ai/recommender/surprise_recommenders.py index f20edc030..ff8ce5768 100644 --- a/ai/recommender/surprise_recommenders.py +++ b/ai/recommender/surprise_recommenders.py @@ -52,7 +52,7 @@ import logging logger = logging.getLogger(__name__) -logger.setLevel(logging.DEBUG) +logger.setLevel(logging.INFO) ch = logging.StreamHandler() formatter = logging.Formatter('%(module)s: %(levelname)s: %(message)s') ch.setFormatter(formatter) @@ -100,15 +100,16 @@ def __init__(self, self.ml_type = ml_type if metric is None: - logger.debug('metric is None, setting...') + logger.warning('metric is None, setting...') self.metric='bal_accuracy' if self.ml_type=='classifier' else 'mse' else: self.metric = metric assert(self.metric is not None) - logger.debug('self.algo_name: '+self.algo_name) - logger.debug('ml_type: '+self.ml_type) - logger.debug('metric: '+self.metric) + logger.info('initlizing SurpriseRecommender') + logger.info('self.algo_name: '+self.algo_name) + logger.info('ml_type: '+self.ml_type) + logger.info('metric: '+self.metric) self.min_epochs = 10 self.max_epochs = 100 @@ -439,7 +440,7 @@ def _update_model(self,results_data): self.algo.n_epochs = min(len(results_data),self.max_epochs) self.algo.n_epochs = max(self.algo.n_epochs,self.min_epochs) - logger.debug('fitting self.algo...') + logger.info('fitting self.algo...') self.algo.partial_fit(self.trainset) - logger.debug('done.') - logger.debug('model SVD updated') + logger.info('done.') + logger.info('model SVD updated') diff --git a/docker-compose-production.yml b/docker-compose-production.yml index c131773ba..fd0a94429 100644 --- a/docker-compose-production.yml +++ b/docker-compose-production.yml @@ -12,6 +12,7 @@ services: volumes: - "/appsrc" - "./data/datasets/user:/appsrc/data/datasets/user" + - "./data/recommenders/pennaiweb:/appsrc/data/recommenders/pennaiweb" - "./target:/appsrc/target" ports: - "5080:5080"