Treasury Management • Intermediate • 50-75 min

Invoice-Level Collections Prediction

Colab-based treasury notebook for invoice-level late-payment prediction, collections prioritization, and calendar-ready cash inflow forecasting.

About Demo Colab Notebook-driven workflow

What this demo is about

Feature-driven collections prioritization

This notebook turns invoice-level business context into a practical treasury analytics workflow. Students see how payment history, invoice terms, disputes, customer relationship signals, regional seasonality, and invoice size can influence late-payment risk scoring — and now, how a second model turns that risk into a predicted payment date, so the output can drive a real cash-forecasting calendar instead of just a ranked list.

Learning objectives

  • Explain how invoice-level features can be used to predict late-payment risk.
  • Compare payment history, invoice terms, relationship signals, and seasonality as collections features.
  • Interpret invoice risk scores as prioritization support rather than automatic truth.
  • Estimate how earlier collections can support DSO improvement and working-capital release.
  • Turn a per-invoice payment-date prediction into a calendar-ready expected cash inflow feed.
  • Adapt a teaching notebook to run on a real ERP invoice export using a provided data template.
  • Compare a naive due-date cash forecast against an AI-adjusted one and quantify the difference.
  • Evaluate a regression model with RMSE on training vs. test data, and recognize overfitting from the gap.
  • Translate a measured accuracy improvement into an annual dollar value, with assumptions made explicit.

Run mode

  • Supported mode: Colab
  • Demo type: notebook launch guide
  • Primary launch surface: index.html

Teacher cue

Look for whether the model is identifying true collections risk, strategic delay, or simply large invoices that attract attention because of size. Then compare the two calendar charts: does the AI-adjusted version look meaningfully different from the naive due-date version, or is the model not actually changing the picture enough to justify the added complexity?

New in this version

Bring your own data, and export a calendar-ready forecast

Data template

The notebook generates a downloadable invoice_data_template.csv with the exact columns it expects and a few sample rows (one deliberately left with blank optional fields). Fill it with a real ERP export, upload it back in, and the same pipeline scores real invoices instead of synthetic ones.

Two models, not one

A classifier predicts whether an invoice will be late; a regressor predicts how many days late or early. Only the second one can answer "when" — which is what a calendar needs.

Calendar exports

Plain CSVs (per-invoice and daily-aggregate expected inflow) plus an optional Google Calendar-style import file, so the output can feed a spreadsheet, a BI tool, or a literal calendar.

Without AI vs. with AI, side by side

The calendar is built two ways from the same invoices: a naive version that assumes every invoice pays exactly on its due date, and an AI-adjusted version shifted by the regressor's prediction. Both are charted together and summarized as a near-term dollar difference, so the model's actual contribution is visible instead of assumed.

New in this version

Is the prediction actually accurate, and is it worth anything?

RMSE, train vs. test

A table compares RMSE and MAE for a naive "assume the due date" baseline against the AI regressor, on both the training set and a held-out test set. A train/test gap flags overfitting; a scatter plot of predicted vs. actual days late makes the fit visual.

Economic value of the accuracy gain

The RMSE improvement is translated into an annual dollar figure using a standard treasury framing: a tighter forecast needs a smaller cash buffer, which frees capital. The formula and its COST_OF_CAPITAL_RATE assumption are fully exposed — the notebook is explicit that this is a discussion number, not a boardroom-ready one.

Teacher cue

Ask students to change COST_OF_CAPITAL_RATE and re-run — how much does the annual value estimate move, and what does that say about how much weight to put on the number itself versus the direction of the result?

Why this matters

Collections analytics should improve timing, not just produce scores

Business context

Late-payment prediction matters because a treasury team wants to direct effort toward invoices where faster action is likely to improve cash timing and reduce DSO.

Key features

Payment history
Invoice amount and terms
Industry and regional stress
Relationship and dispute signals
Predicted expected payment date
Daily expected cash inflow

What students should note

The highest-risk score is not always the best immediate collections target. Teams still need judgment about customer strategy, dispute status, and expected recoverability.