Skip to content

Commit

Permalink
predictor: Adding additional logging statements
Browse files Browse the repository at this point in the history
  • Loading branch information
m-d-brown committed Apr 11, 2023
1 parent 554232c commit 4588a20
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions smart_importer/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __call__(self, importer, file, imported_entries, existing_entries):
Returns:
A list of entries, modified by this predictor.
"""

logging.debug("Running %s for file %s", self.__class__.__name__, file)
self.account = importer.file_account(file)
self.load_training_data(existing_entries)
with self.lock:
Expand Down Expand Up @@ -119,8 +119,10 @@ def load_training_data(self, existing_entries):
)
else:
logger.debug(
"Filtered training data to %s of %s entries.",
"Loaded training data with %d transactions for account %s, "
"filtered from %d total transactions",
len(self.training_data),
self.account,
len(all_transactions),
)

Expand Down Expand Up @@ -227,12 +229,17 @@ def process_transactions(
self.apply_prediction(entry, self.targets[0])
for entry in transactions
]
logger.debug("Apply predictions without pipeline")
elif self.pipeline:
predictions = self.pipeline.predict(transactions)
transactions = [
self.apply_prediction(entry, prediction)
for entry, prediction in zip(transactions, predictions)
]
logger.debug("Added predictions to transactions.")
logger.debug("Apply predictions with pipeline")
logger.debug(
"Added predictions to %d transactions",
len(transactions),
)

return transactions

0 comments on commit 4588a20

Please sign in to comment.