<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zhongbin Huang on Medium]]></title>
        <description><![CDATA[Stories by Zhongbin Huang on Medium]]></description>
        <link>https://medium.com/@zhongbinhuang?source=rss-374f8bff9590------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4F7d6N7SLF8LaMLQ.</url>
            <title>Stories by Zhongbin Huang on Medium</title>
            <link>https://medium.com/@zhongbinhuang?source=rss-374f8bff9590------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 15:54:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zhongbinhuang/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Receipt Information Extraction]]></title>
            <link>https://medium.com/@zhongbinhuang/receipt-information-extraction-c09c2a33f40c?source=rss-374f8bff9590------2</link>
            <guid isPermaLink="false">https://medium.com/p/c09c2a33f40c</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Zhongbin Huang]]></dc:creator>
            <pubDate>Tue, 14 Aug 2018 21:17:30 GMT</pubDate>
            <atom:updated>2018-08-14T21:17:30.845Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/699/0*ilckMEEdLX5rjB0U" /></figure><h3>Introduction</h3><p>This is a real industry project that will be eventually used by an APP. When user scanned their receipts using this APP, detail information is returned in JSON format. Currently, this APP is using naive rule-based method to determine the merchant name and getting poor accuracy. The goal of this project is to extract the correct merchant names from different receipts using these OCR records.</p><h3>Procedures</h3><p>Here are the procedures we implemented using a combination of rule-based method and machine learning:</p><ol><li><strong>Merchant name matching</strong></li></ol><ul><li>Built a list of common merchant names (~1000 merchants) that covered most of the international and regional big merchants.</li><li>Tokenize the receipt full text and make list of ngrams.</li><li>Match the word list of a receipt and the pre-made merchant name list, if there is a match, use the matching merchant as the receipt merchant name.</li><li>Use these receipts to build training data for the machine learning step.</li></ul><p><strong>2. Machine learning to predict merchant name</strong></p><ul><li>Each item in the word list of a receipt from the previous step will be one data item to train the machine learning model. On average, about 500 data entries for one receipt.</li><li><strong>Feature Engineering</strong>: Build different features of the words including top-bottom-left-right margin, word height, having capital letter, vertical/horizontal position, having digits, and etc. based on the scanned OCR records.</li><li>After building the feature matrix, over sample the word that are merchant name since the data set label are highly bias (less words are merchant names).</li><li>Try different machine learning models and obtain the one with best recall and accuracy score on the testing data.</li><li>Use the trained model to predict the merchant name on a new receipt.</li></ul><h3>Results and Plots</h3><h3>Previous method</h3><p>Using the old rule-based approach that using the first line of the receipt as the merchant name, by sampling and human visualisation, the accuracy is around 30%.</p><h3>Our method</h3><p>Our premade merchant list will cover 50% of the total receipts, which implies we can get 50% of the merchants as our baseline.</p><p>Then we use the receipts that have the matching merchant name to train a general purpose machine learning model to predict the merchant names of the remaining receipts. The recall score of our the random forest model is the highest, of 0.40. This implies that we are able to have a total accuracy of 50%+50%0.4=70%</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/0*0-iIEFgqEfIBgThj" /></figure><h3>Other data explorations</h3><p>The key assumption of our machine learning model is that most of the merchant receipts will have similar patterns. Based on the ones that we already know what the merchant names are, we can predict the rest.</p><p>The graph below marks the position of the merchant names for more than 10000 receipts. We can see that most of the merchant names will be on the top left of the receipts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/0*FTtJUiPhxdM8kSF7" /></figure><p>The reason of using recall score instead of model accuracy is that the data labels are highly bias. (If the model says no words are merchant name, accuracy is still very high). Details about machine learning algorithm metrics refer to scikit-learn documentation.</p><p>Group by currency, we find out most transactions happen in English speaking country (USD, CAD, AUD).</p><p>About 5% of the receipts are non-letter languages, our method will not work on those.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/0*7aEz66YbDha7RWBP" /></figure><p>More interesting data analyst, a bubble graph showing average amount spent vs. average tax paid group by currency and merchant name. Size of bubble indicates number of receipts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*9tBweay4gbCOvRnr" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c09c2a33f40c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>