return self.imported_transactions
// predict payees
self.transactions = self.imported_transactions
if self.predict_payees:
logger.debug("About to generate predictions for payees...")
predicted_payees: List[str]
predicted_payees = self.pipeline.predict(self.transactions)
self.transactions = [ml.add_payee_to_transaction(*t_p, overwrite=self.overwrite_existing_payees)
for t_p in zip(self.transactions, predicted_payees)]
logger.debug("Finished adding predicted payees to the transactions to be imported.")
// suggest likely payees
After Change
return self.imported_entries
updated_transactions: List[Transaction]
updated_transactions = list(filter_txns(self.imported_entries))
// predict payees
if self.predict_payees:
logger.debug("About to generate predictions for payees...")
predicted_payees: List[str]
predicted_payees = self.pipeline.predict(updated_transactions)
updated_transactions = [ml.add_payee_to_transaction(*t_p, overwrite=self.overwrite_existing_payees)
for t_p in zip(updated_transactions, predicted_payees)]
logger.debug("Finished adding predicted payees to the transactions to be imported.")
// suggest likely payees
if self.suggest_payees:
// get values from the SVC decision function
logger.debug("About to generate suggestions about likely payees...")
decision_values = self.pipeline.decision_function(updated_transactions)
// add a human-readable class label (i.e., payee"s name) to each value, and sort by value:
suggested_payees = [[payee for _, payee in sorted(list(zip(distance_values, self.pipeline.classes_)),
key=lambda x: x[0], reverse=True)]