Smart Importer

336 views
Skip to first unread message

Brian McGee

unread,
Dec 2, 2020, 2:16:12 PM12/2/20
to Beancount

Smart Importer appears to be working but I cannot get it to train properly (I think, I'm green). Is this the right place for this question? Thanks so much.

Here is my logging debug:

DEBUG - Calling the importer's extract method. 
DEBUG - Filtered training data to 42 of 134 entries. 
DEBUG - Trained the machine learning model. DEBUG - Added predictions to transactions. 
DEBUG - Filtered training data to 42 of 134 entries. 
WARNING - Cannot train the machine learning model because there is only one target.

my bean-extract call:

bean-extract -e finances2020.beancount personal.import documents/preImport/renamed

applying hooks:

apply_hooks(brianCheck, [PredictPostings(), PredictPayees()]),

Aaron Lindsay

unread,
Dec 2, 2020, 2:28:29 PM12/2/20
to Beancount
It's hard to make perfect sense of your DEBUG prints since I don't know where in the code you inserted them, but is it possible you only have 42 transactions total in finances2020.beancount and only 1 against the account you're importing into?

-Aaron

Brian McGee

unread,
Dec 2, 2020, 6:03:11 PM12/2/20
to bean...@googlegroups.com
Thanks so much Aaron —

I actually have 42 of the transactions from that account in my finances2020.beancount and am attempting to import 28 transactions with the same account. Maybe because I pass in the account in the .import file rather than explicitly in the importer?

brianCheck = usaa.USAABankImporter(
'Assets:USAA:PersonalChecking',

--
You received this message because you are subscribed to a topic in the Google Groups "Beancount" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beancount/Z22nmCYH1Qw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/b32ac673-610c-4a82-8935-be08612b04bdn%40googlegroups.com.

Eric Glanz

unread,
Dec 2, 2020, 6:55:06 PM12/2/20
to bean...@googlegroups.com
The two hooks are going to be applied in the order that they appear in the array.  My guess is that the first 3 debug lines are from the PredictPostings hook, followed by 2 debug lines from PredictPayees.

My guess is that out of your 42 transactions only one has a payee listed or multiple transactions have the same payee.  The rules for payee/narration tripped me up at first, so you might want to review the docs for payee and narration here: https://beancount.github.io/docs/beancount_language_syntax.html#payee-narration

Hope this helps!

Eric



You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAONa%2BnTmVcFJu%2BS_Au-DAWsvHPCt8BmyReqbQTW24Y2EuY2trg%40mail.gmail.com.

Brian McGee

unread,
Dec 2, 2020, 7:17:22 PM12/2/20
to bean...@googlegroups.com
Ah that did it Eric! Thanks.

I'm still getting no changed payees or postings but could be my data. My payees in the .beancount file are pretty rough ie "AMAZON.COM*MK5LX0H60AMZN.COM/BILL" and don't have a ton of data "Filtered training data to 21 of 133 entries" so maybe that's why. Anyway this is exciting thank you.

Brian

jrgo...@gmail.com

unread,
May 30, 2021, 7:01:00 AM5/30/21
to Beancount
I'm getting this same error as well now on a new account I'm adding. I'm not sure how to turn logging on. Sorry if this is a basic question but is there a flag I can invoke set when I invoke bean-extract?  Or do I add a line in the code with predictor.py? It still is generating some predictions. I'm invoking the code as follows:

bean-extract -e journal/accounts.beancount jonathan_smart.import ~/staging/my_credic_card.ofx > ~/staging/my_credit_card.ofx.extract 

and I get this: "Cannot train the machine learning model because there is only one target."

but the file contains the extracted beancount statements and some predictions.

jrgo...@gmail.com

unread,
May 30, 2021, 5:15:26 PM5/30/21
to Beancount
I see this on the wiki:

Configuring Logging

Python's logging module is used by the smart_importer module. The according log level can be changed as follows:

import logging 
logging.getLogger('smart_importer').setLevel(logging.DEBUG)

Where do I put this code? The program being executed is bean-extract. It reads in a file (e.g. Jonathan_smart.import in my case). If I put those two lines in that file I don't see any console logging occurring. I'm not that familiar with logging so trying to read the docs and understand how to configure.

thanks,
Jonathan

Ben Blount

unread,
May 30, 2021, 5:35:11 PM5/30/21
to Beancount
Hey Jonathan,
I don't know the specifics of how to configure the standard Python logger. I just want to offer that you might have a better time with a debugger, which lets you see and change program state at breakpoints. Python being an interpreted language it is one of the absolute easiest languages to debug. Pycharm is great and free.

You can set breakpoints in any python code. Then set pycharm to running bean-extract's entry script: https://github.com/beancount/beancount/blob/v2/bin/bean-extract



Reply all
Reply to author
Forward
0 new messages