Non-FictionBusiness BriefExpense AI

AI Expense Categorization eBook

Train machine learning models to auto-classify exp

by Lawton Glynis

  • English
  • 146 pages
  • 2026
  • SamEnrico

Train machine learning models to auto-classify expenses and learn business spending patterns.

Formats

Free sample

Chapter 1: The Receipt Graveyard--–- The email arrived at 4:47 PM on a Friday, which is how you know it was bad news. Sarah, the finance director for a mid-sized software company, stared at her screen. Her CEO had just asked for a real-time budget update before Monday’s board meeting. Not the usual “we’re fine” answer. Actual numbers.

Actual category-level spend. Actual understanding of where the money went.Sarah opened Quick Books. Then Excel. Then the corporate card portal. Then the expense management system.

Then the three separate spreadsheets that different departments used because nobody liked the “official” system. Then she did what finance people have done since the invention of the double entry: she started manually copying, pasting, and categorizing.At 11:47 PM, three hours after her kids went to bed, she found it. A single transaction from six months ago: “MORGAN STANLEY PARKING GARAGE” for $847. The rule-based system had no idea what to do with that. Was it Travel?

Parking rarely is. Was it Meals? No. Office Supplies? Definitely not.

The system, following its programmed logic, had shoved it into “Miscellaneous Expense” — the digital equivalent of sweeping dirt under the rug.That one miscategorized transaction had cascaded. The parking charge belonged to a client visit that should have been billed back. It wasn’t. The travel budget for Q2 showed a mysterious 847overrunthatnobodycouldexplain.The CEO,lookingatthedashboard,hadcutthetravelbudgetfor Q3basedonfaultydata.Thesalesteam,deprivedofclientvisitfunds,hadmissedthreemeetings.Threemeetingsthatwouldhaveclosed847 overrun that nobody could explain. The CEO, looking at the dashboard, had cut the travel budget for Q3 based on faulty data.

The sales team, deprived of client visit funds, had missed three meetings. Three meetings that would have closed 847overrunthatnobodycouldexplain.The CEO,lookingatthedashboard,hadcutthetravelbudgetfor Q3basedonfaultydata.Thesalesteam,deprivedofclientvisitfunds,hadmissedthreemeetings.Threemeetingsthatwouldhaveclosed120,000 in pipeline deals.All because a machine followed its rules perfectly.The Myth of Perfect Rules Here is the first hard truth this book will teach you: rules-based accounting works beautifully until it fails catastrophically. And it will fail. Not because the rules are badly written, but because expense data is fundamentally adversarial to rules. The messiness is not a bug in the data—it is a feature of reality.Let me show you what I mean.Take a simple rule: IF merchant_name CONTAINS “Uber” THEN category = “Ground Transportation”Works fine, right?

Now watch what happens when real data arrives:Merchant Name as It Appears in Bank Feed Does “Uber” Rule Fire?“Uber *Trip”Yes“Uber BV”Yes“Uber Eats”Yes — but this is food delivery, not ground transport“UBER TECHNOLOGIES”No (case sensitivity)“Uber 04/15/24”Yes“Uber Ride”Yes“Über”No (special character)The rule gets it wrong in multiple ways. It categorizes Uber Eats as ground transportation. It misses Uber Technologies due to case sensitivity. And here is the deeper problem: Uber itself started as a ride-hailing service, then added food delivery, then added freight, then added… you get the idea. The rule you write today will be wrong tomorrow because the world changes.This is not a hypothetical problem.

In 2023, a large enterprise client of mine analyzed their expense data and found that 23% of their rules-based categorizations were wrong. Not close. Wrong. The company had 85,000 employees submitting 1.2 million expenses per year. At 28permanualreview(theaveragecostoffinancelabor),that2328 per manual review (the average cost of finance labor), that 23% error rate represented 28permanualreview(theaveragecostoffinancelabor),that237.7 million in either misallocated budgets, compliance risk, or manual rework.Worse, the errors were not random.

They clustered around the highest-value transactions. International travel. Legal fees. Professional services. The very categories where a single mistake has outsized consequences.The Dirty Secret of Receipt Data Before we can build a machine learning model to categorize expenses, we need to understand what we’re up against.

Expense data is not clean. It is not consistent. It actively resists easy categorization. Here are the real problems you will face the moment you start working with expense data.Problem One: Merchant Name Chaos Bank feeds do not send nice, clean merchant names. They send whatever the payment processor decided to send.

Consider the humble Starbucks receipt. In real data, I have seen the same coffee shop appear as:STARBUCKS #4721SBUX 4721Starbucks Coffee Company Starbucks Store 04721Starucks 4721 (typo)STRBUCKS 4721Starbucks 4721A rules-based system would need seventeen separate patterns to catch one coffee shop. A human can look at any of these and instantly know “this is Starbucks.” A machine, without the right techniques, cannot.Problem Two: The Missing Memo Problem Expense reports have memo fields. Employees are supposed to write something useful there like “Client lunch with Acme Corp” or “Q3 cloud hosting.” What do they actually write? I have seen memos that read “asdf,” “lunch,” “call me,” “,” (literally just a comma), “expense,” and my personal favorite — a 200-character string of random numbers that turned out to be a cat walking across the keyboard.When the memo is empty or useless, the model must infer the category from the merchant alone.

That works for Starbucks (likely Meals) but fails for generic merchants like “Apple” (technology hardware? software subscription? the fruit?).Problem Three: Split Transactions An employee goes to Costco. They buy 50ofofficesupplies,50 of office supplies, 50ofofficesupplies,30 of snacks for the break room, and a 20personalpurchasetheypromisetoreimburse.Thebankshowsonetransactionfor20 personal purchase they promise to reimburse. The bank shows one transaction for 20personalpurchasetheypromisetoreimburse.Thebankshowsonetransactionfor100.

How do you categorize it? You can’t. You need the receipt. And if the receipt is lost, someone has to guess.This is not an edge case. In a 2022 study of 50,000 corporate expenses, 18% were split transactions requiring manual allocation.

Rules-based systems simply fail here.Problem Four: Foreign Currencies and Date Formats Your company has offices in London, Tokyo, and Austin. The bank feed from London shows “1/2/23” — is that January 2 or February 1? The amount shows “£847” — what is that in USD? The merchant name is in Japanese characters — how does your rule match “スターバックス” to “Starbucks”?These problems are solvable, but not with simple rules. They require data cleaning, normalization, and feature engineering — all of which we will cover in Chapter 3.Problem Five: The Long Tail of Rare Merchants Every company has their core merchants: the regular software subscriptions, the office supply store, the coffee shop near the office.

Those are easy. The problem is the long tail — the thousands of merchants that appear once or twice per year.In one dataset I analyzed, the top 5% of merchants accounted for 80% of transaction volume by count, but only 40% of transaction volume by dollar value. The long tail (the other 95% of merchants) accounted for 60% of the money. The expensive transactions are the rare ones. The legal fees.

The consulting payments. The international travel. The equipment leases. These appear rarely, but when they appear, they matter.A rules-based system, by definition, can only handle merchants you have seen before. The first time an employee expensed a flight on a new airline, the rule would fail.

You would need to write a new rule. Then another. Then another. The rules multiply. The system becomes unmaintainable.The True Cost of a Miscategorized Expense Let me tell you about James.James was a senior engineer at a publicly traded company.

He expensed a dinner with a potential client: $847 at a steakhouse in Chicago. In the expense system, he selected “Meals” from the…

This is the end of the free sample. Get the eBook to keep going. Buy now

About this book

Train machine learning models to auto-classify expenses and learn business spending patterns.

Details

Author
Lawton Glynis
Publisher
SamEnrico
Language
English
Genre
Non-Fiction, Business Brief, Expense AI
Released
2026-05-29
Pages (approx.)
146
Available as
eBook, Audiobook

Read better in the ZLOADR app

Your eBooks on your phone or tablet. Sign in with your SamEnrico account and start reading.

More by Lawton Glynis

See all

You may also like

See all