Live data from Hacker News

Extracting campaign finance data from gnarly PDFs using deep learning

jonathanstray.com

1–10 of 17 posts

Re: Extracting campaign finance data from gnarly PDFs using deep learning

#3
> This project aimed to find out, and successfully extracted the easiest of the fields (total amount) at 90% accuracy using a relatively simple network.

Why does this page not even say what this field was? For all we know, OpenCV would have worked better.

Re: Extracting campaign finance data from gnarly PDFs using deep learning

#4

> This project aimed to find out, and successfully extracted the easiest of the fields (total amount) at 90% accuracy using a relatively simple network. Why does this page not even say what this field was? For all we know, OpenCV would have worked better.

As it states, the field in question is "Total amount"

Re: Extracting campaign finance data from gnarly PDFs using deep learning

#6
post #2

Looks like a very shallow article that hasn't actually solved the meat of the problems. Am I reading it wrong?

Heh. It’s my work, so maybe I can clarify the goals. This is meant to be a proof of concept. I took a week and was able to show that relatively simple deep learning techniques are capable of generalizing over unseen form types with high accuracy. I also showed that tokens-plus-geometry is a viable format, and that hand-crafted feature engineering is still necessary (and still used in SOTA approaches).

I also believe that preparing and cleaning this data set, and bringing a challenging investigative journalism problem to the attention of other researchers, would be valuable even if I hadn’t done any work on this baseline solution. This is a problem that journalists currently expend a huge amount of time and money on, which reduces the effectiveness of transparency around political ad spending information.

Re: Extracting campaign finance data from gnarly PDFs using deep learning

#7
post #5

Accuracy may not be the best metric, if your dataset is imbalanced.

It’s not a binary classifier. Every invoice in the dataset has a total amount written somewhere on it. Accuracy here is whether the network chooses the correct token from each PDF.

Re: Extracting campaign finance data from gnarly PDFs using deep learning

#8
My personal bet is that you would have probably gotten better results by simply feeding your data into xgboost or lightgbm.

This current fad of focusing on neural networks just seems sorta silly when we have simpler and (often) better performing models. Just look at what sorts of models win kaggle competitions.

Re: Extracting campaign finance data from gnarly PDFs using deep learning

#9
post #2

Looks like a very shallow article that hasn't actually solved the meat of the problems. Am I reading it wrong?

Heh. It’s my work, so maybe I can clarify the goals. This is meant to be a proof of concept. I took a week and was able to show that relatively simple deep learning techniques are capable of generalizing over unseen form types with high accuracy. I also showed that tokens-plus-geometry is a viable format, and that hand-crafted feature engineering is still necessary (and still used in SOTA approaches). I also believe…

I'm curious if you considered or attempted to use pdfplumber's table extraction methods to separate tabular from non-tabular text. That would be my starting point on a problem like this, as picking the relevant rows of a table is far easier than picking from the set of all tokens. By the way, when you say tokens, you're referring to non-whitespace characters separated by whitespace? How reliable have you found pdfplumber to be in picking out words/tokens?

Re: Extracting campaign finance data from gnarly PDFs using deep learning

#10

Earlier quoted context omitted.

Heh. It’s my work, so maybe I can clarify the goals. This is meant to be a proof of concept. I took a week and was able to show that relatively simple deep learning techniques are capable of generalizing over unseen form types with high accuracy. I also showed that tokens-plus-geometry is a viable format, and that hand-crafted feature engineering is still necessary (and still used in SOTA approaches). I also believe…

I'm curious if you considered or attempted to use pdfplumber's table extraction methods to separate tabular from non-tabular text. That would be my starting point on a problem like this, as picking the relevant rows of a table is far easier than picking from the set of all tokens. By the way, when you say tokens, you're referring to non-whitespace characters separated by whitespace? How reliable have you found pdfplu…

I didn’t try separating out tables because the total field isn’t actually “inside” the table in many cases. Certainly the other fields I want are not.

pdfplumber seems mostly ok at extracting tokens. Sometimes it seems to combine tokens that should be separate. I suspect a few percent of the error is actually problems earlier in the data pipeline, as opposed to the model proper.

Post reply on HN