Cumulative Gain Calculator

The Cumulative Gain Calculator computes cumulative gains for ranked predictions, helping evaluate classification model performance and compare segments across thresholds.

Cumulative Gain Calculator Calculate cumulative gain across multiple periods using either starting/ending value, average periodic return, or a list of period returns.
Choose how you want to compute cumulative gain.
Used for Value mode. Must be > 0.
Used for Value mode. Must be > 0.
Used for Average mode. Example: 2.5 means +2.5% per period.
Used for Average mode. Must be an integer ≥ 1.
Used for List mode. Enter each period return as a percent (e.g., -2 for -2%).
If provided, we compute the ending value using the cumulative factor.
Compound multiplies (1+r) each period. Simple adds returns and is less accurate for volatile series.
Example Presets

Report an issue

Spotted a wrong result, broken field, or typo? Tell us below and we’ll fix it fast.


What Is a Cumulative Gain Calculator?

A cumulative gain calculator measures how many positive outcomes you collect as you move through a ranked list. You sort items by a score, take the top slice, and count the positives found so far. This creates a curve that shows how much better your ranking is than random selection.

Analysts use cumulative gain to judge models, campaigns, and targeting rules. It is common in marketing response modeling, fraud detection, and credit risk. Because it relies on order, not calibrated probabilities, it works with raw scores as long as the ranking is meaningful.

The calculator summarizes performance over the population distribution. It reports cumulative counts, cumulative percentages, and lift at each depth. Many teams also group the list into equal-sized intervals (like deciles) to simplify review and decision making.

Cumulative Gain Calculator
Model cumulative gain and see the math.

Cumulative Gain Formulas & Derivations

At the core, cumulative gain answers: given a ranking, how many positives have we found by the time we reach a certain depth? Below are the standard definitions used to compute it.

  • Sort items by score in descending order. Let yi be 1 if item i is positive, else 0. Let N be total items, and P be total positives (sum of yi across all items).
  • Cumulative gain at depth k (items): CG(k) = sum from i = 1 to k of yi. This is the cumulative count of positives among the top k ranked items.
  • Cumulative gain percentage at population share q = k / N: CG%(q) = CG(k) / P. It reports the fraction of all positives captured by the time you reach q of the list.
  • Baseline expected positives under random selection at depth k: E(k) = k × (P / N). Lift at depth k is L(k) = CG(k) / E(k). Lift above 1 indicates better than random.
  • Incremental gain for interval j (for grouped analysis) is the difference: IG(j) = CG(kj) − CG(kj−1). This shows positives added by that slice.
  • When grouping into equal-width intervals (e.g., deciles of 10%), kj = j × (N / J) for J intervals. Compute CG and lift at each boundary.

These definitions extend to weighted data by replacing counts with weighted sums. If items have weights wi, sum wi × yi instead. All ratios and lift definitions remain the same when applied to weighted totals.

How to Use Cumulative Gain (Step by Step)

Use cumulative gain to evaluate and compare ranking strategies. The process is straightforward and works even when probabilities are uncalibrated. It focuses on how the distribution of positives stacks near the top of the list.

  • Rank your population by a model score or rule-based priority.
  • Define the positive class (responders, frauds, payers, defects, etc.).
  • Pick depth points or intervals (e.g., top 1%, 5%, 10%… or deciles).
  • At each depth, count how many positives are found so far.
  • Compare observed cumulative counts to the random baseline and compute lift.
  • Choose an operating point that balances gain, cost, and capacity.

By scanning the curve, you can see early concentration of positives. A steep early rise means strong ranking power. Flat regions suggest little separation between positives and negatives.

Inputs and Assumptions for Cumulative Gain

To run the analysis, you need a ranked list and ground-truth labels. You can compute on the full dataset or a representative sample. The calculator summarizes main metrics across chosen intervals and at specific depths.

  • Scores or ranks for each item (higher means more likely positive).
  • Binary labels for the actual outcome (1 for positive, 0 for negative).
  • Population size N and positive count P (the prevalence defines the baseline).
  • Interval scheme (e.g., deciles, quintiles, or custom depth points).
  • Optional weights per item for stratified samples or business value weighting.

Ensure scores align with the intended order. If the model outputs lower scores for positives, reverse the sorting. For ties, use a stable tie-break rule or average assignment across tied items. Extreme class imbalance or skewed sampling can change how you interpret lift and gains; document these conditions with the result.

How to Use the Cumulative Gain Calculator (Steps)

Here’s a concise overview before we dive into the key points:

  1. Upload or paste your data with columns for score and actual label.
  2. Select which column is the score and which is the positive label.
  3. Choose your interval scheme (deciles by default) or specific depth points.
  4. Pick options for weighting, tie handling, and whether to normalize to percentages.
  5. Run the Calculator to compute cumulative counts, percentages, and lift values.
  6. Review the table and chart to locate the depth that meets your capacity.

These points provide quick orientation—use them alongside the full explanations in this page.

Example Scenarios

Marketing response. You have 100,000 customers and 5,000 past responders (5% prevalence). A model scores everyone for the next email. In the top 10% (10,000 people), you find 2,000 past responders. CG(10%) = 2,000, CG%(10%) = 2,000 / 5,000 = 40%. The random baseline at 10% is 10% of 5,000 = 500. Lift at 10% is 2,000 / 500 = 4. This suggests a strong early concentration of likely responders.

What this means: Targeting only the top 10% could capture 40% of all responders with four times the density of random.

Fraud detection. There are 1,000,000 transactions with 0.2% fraud (2,000 frauds). The top 1% by score holds 10,000 transactions. In that slice you find 800 frauds. CG(1%) = 800, CG%(1%) = 800 / 2,000 = 40%. The random baseline at 1% is 1% of 2,000 = 20. Lift at 1% is 800 / 20 = 40. Inspection resources can focus there for rapid impact.

What this means: Reviewing only 1% of transactions could surface 40% of fraud with forty times the random rate.

Assumptions, Caveats & Edge Cases

Cumulative gain depends on ranking quality and data realism. The curve is stable when the data reflect the real-world distribution and the score produces consistent ordering.

  • Sampling shifts reduce comparability. If training and test sets differ, lift may not generalize.
  • Temporal drift changes prevalence P. Update baselines when the positive rate moves.
  • Heavily imbalanced data amplify variance at small depths. Use larger intervals for stability.
  • Score monotonicity matters more than calibration. Recalibrate only if order is distorted.
  • Ties in score can blur the curve at interval boundaries. Apply a consistent policy.

Always validate on a holdout or recent period. If the curve improves only on old data, the gain may not hold. Pair cumulative gain with cost assumptions to pick operating points that fit real capacity and budgets.

Units Reference

Units clarify how to read the curve and tables. Some values are counts, others are percentages, and some are unitless ratios. Mixing them can confuse decisions, especially when comparing across intervals of different sizes.

Common quantities and their units in cumulative gain analysis
Quantity Symbol Unit Notes
Population size N count Total number of items evaluated.
Positive count P count Total positives in the dataset.
Depth k count or % of N Items included from the top of the ranking.
Cumulative gain CG(k) count Positives captured up to depth k.
Cumulative gain percentage CG%(k) percent CG divided by P, shown as a percentage.
Lift L(k) unitless ratio Observed gain divided by random expectation.

When comparing, align units. For example, compare CG% at the same percentage depth, not at different k values. Lift is dimensionless, so it can be compared across datasets with different sizes, but only if prevalence is similar.

Common Issues & Fixes

Most issues come from mis-sorted data, mislabeled classes, or confusion between cumulative and incremental measures. These are usually easy to spot and correct.

  • Problem: Scores sorted ascending. Fix: Sort descending so higher scores come first.
  • Problem: Swapped labels for positive and negative. Fix: Confirm label coding before upload.
  • Problem: Reading incremental gain as cumulative. Fix: Check whether values are “so far” or “in this interval.”
  • Problem: Using different interval sizes. Fix: Use consistent intervals to compare models.
  • Problem: Data leakage inflates early gains. Fix: Rebuild with strict time-based splits.

If the curve looks too perfect, revisit data preparation. Spikes at small depths can be normal in rare-event data, but they should stabilize as depth grows. Document any filtering or sampling so others can interpret the result correctly.

FAQ about Cumulative Gain Calculator

How is cumulative gain different from lift?

Cumulative gain counts positives found up to a depth, while lift divides that count by the random baseline; lift shows relative improvement.

Do I need calibrated probabilities to use cumulative gain?

No. You only need a ranking where higher scores tend to be positives; calibration is optional unless you report probabilities.

Can I use cumulative gain for multi-class problems?

Yes, treat one class as the positive class at a time and compute a curve per class; compare curves carefully due to different prevalence.

How many intervals should I choose?

Deciles (10 intervals) are common. Use fewer intervals for small samples and more intervals if your dataset is large and stable.

Glossary for Cumulative Gain

Cumulative Gain

The total number or percentage of positives found up to a chosen depth in a ranked list.

Lift

The ratio of observed cumulative gain to the random expectation at the same depth; values above 1 indicate improvement.

Decile

An interval representing 10% of the population, used to group and summarize gains across the distribution.

Positive Class

The outcome of interest, such as responder, fraud, or defect, coded as 1 for analysis.

Incremental Gain

The number of positives found within a specific interval, not the total so far.

Baseline

The random selection expectation used for comparison; it depends on the positive rate P/N.

Operating Point

The depth or interval you choose to act on, based on gain, capacity, and cost constraints.

Prevalence

The positive rate in the data, equal to P divided by N; it sets the baseline for comparisons.

Sources & Further Reading

Here’s a concise overview before we dive into the key points:

These points provide quick orientation—use them alongside the full explanations in this page.

Save this calculator
Found this useful? Pin it on Pinterest so you can easily find it again or share it with your audience.

Leave a Comment