---
title: What you can predict
description: How to frame a prediction for Avra RFM — the records to score, who's in, the outcome, and its window — and the kinds of targets it predicts.
---

A prediction answers one question about one kind of record in your database: for each of these records, what happens over this window? You frame it once. From then on, Avra computes the answer at any date: the labels it learns from in your history, and the scores it returns for the records you ask about.

## The parts of a prediction

Every prediction has the same four parts.

| Part | What it says | Example |
|------|--------------|---------|
| **The records** | One kind of record, identified by its table's key | Each customer in `customers` |
| **Who's in** | Optional filters, on the records' own columns or on what happened before the prediction date | Customers with at least one order in the last 90 days |
| **The outcome** | What to predict, computed from what happens after the prediction date | No order placed |
| **The window** | When the outcome is measured, counted from the prediction date. Its end is the horizon, when the answer is known | The next 28 days |

<svg class="fig" viewBox="0 0 640 240" role="img" aria-label="A timeline with the prediction date in the middle. Before it lie the history the model may read and a past window that decides which records are scored. After it lies the future window over which the outcome is measured, ending at the horizon.">
  <defs>
    <marker id="fig-anatomy-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
      <path d="M0,0 L10,5 L0,10 z" class="arrow" />
    </marker>
  </defs>
  <rect class="head" x="24" y="126" width="348" height="30" rx="4" />
  <text class="small label" x="36" y="145">history the model may read</text>
  <rect class="soft" x="212" y="86" width="160" height="30" rx="4" />
  <text class="small mid" x="292" y="105">past window: who's in</text>
  <rect class="solid" x="372" y="86" width="160" height="30" rx="4" />
  <text class="small mid on-solid" x="452" y="105">future window: outcome</text>
  <line class="edge" x1="24" y1="168" x2="612" y2="168" marker-end="url(#fig-anatomy-arrow)" />
  <text class="small label end" x="612" y="158">time</text>
  <line class="edge-accent" x1="372" y1="44" x2="372" y2="178" />
  <text class="small mid accent title" x="372" y="34">prediction date</text>
  <line class="edge" x1="212" y1="163" x2="212" y2="173" />
  <text class="small label mid" x="212" y="190">90 days before</text>
  <line class="edge" x1="532" y1="163" x2="532" y2="173" />
  <text class="small label mid" x="532" y="190">28 days after</text>
  <path class="edge-accent" d="M372,202 v6 h160 v-6" />
  <text class="small mid accent" x="452" y="226">horizon: when the answer is known</text>
</svg>

The parts of a prediction on one timeline. Who's in is decided by what happened before the prediction date, the outcome is measured over the window after it, and the horizon is when the answer is known.

The prediction date is the date a prediction is made for. Everything before it is history the model may read, and the outcome is measured over the window after it. Avra uses the same framing in both directions. Looking back, it computes the outcome at past dates, which gives the labelled examples the model learns from in context and the truth a backtest is scored against. Looking forward, it scores your records at today's date, before their outcome is known.

## Kinds of targets

A **yes-or-no outcome** is a condition on what happens in the window: will this customer place no order in the next 28 days, will this loan go 30 days past due within 90 days, will this lead convert this month. The RFM returns a score that ranks records by how strongly they point to the outcome. Scores rank and compare records; they aren't calibrated probabilities, so set thresholds from your own outcomes. See [Risk bands](/use-cases/credit-intelligence/homogeneous-groups).

A **number** is an amount, a count, or an average over the window: how much a customer will spend in the next 28 days, or how many tickets an account will open next month. The RFM returns an estimate of the value.

A **ranking** comes from scores: score every candidate, then sort. Lead prioritization, collection queues, and fraud review queues all work this way, so they need no separate kind of target.

A **missing value** in the records' own table can be predicted too: a customer's age where it's missing, say, from the row's other columns and its related rows, as they stood on the prediction date. It follows the column's kind: a number, a yes-or-no value, or, with a fine-tuned copy, a category.

Other kinds of targets, such as one category among several, a date, or a list of items, are set up with your Avra team, with a [fine-tuned copy](/rfm/adaptation) where the task calls for one.

## Examples

The same four parts describe very different questions:

| Question | The records | Who's in | The outcome | Window |
|----------|-------------|----------|-------------|--------|
| Which merchants will churn? | Merchants | Active in the last 90 days | No transactions | 28 days |
| Which new loans will go delinquent? | Loans | Disbursed recently | 30 or more days past due | 90 days |
| Which new accounts belong to a fraud ring? | Accounts | Opened recently | Confirmed fraud | 7 days |
| Which leads will convert? | Leads | Open | Converted | 30 days |
| How much will each customer spend? | Customers | Bought in the last 90 days | Sum of order amounts | 28 days |
| How many tickets will each account open? | Accounts | Active | Count of tickets | 30 days |

## Conditional outcomes

Some questions only make sense under a condition, such as how much a customer will spend if they buy at all. A prediction can carry that condition. The model learns only from records where the condition held, and it scores every record in the population as if the condition holds, so the answer reads as "spend, given a purchase."

## Rules that keep a prediction honest

The outcome is always measured after the prediction date, and filters on who's in can only look at what happened before it. A record exists from its own time: a customer who signs up after the prediction date isn't scored for that date, and isn't part of the history before it.

An outcome is computed only where the data covers its whole window, so a window that runs past the end of your data doesn't read as "nothing happened." And if a column on the record itself gives the answer away, such as a `status` set to `defaulted` once a loan defaults, tell your Avra team: that column can be hidden from the prediction.

## Framing a good prediction

Start from the decision the prediction serves, and let it set the window: a collections team that acts weekly needs a different horizon than an annual loss forecast. Define the outcome the way you measure it today, your definition of default or churn, not a generic one. Check that your history holds enough past outcomes, over enough periods, to evaluate the prediction on dates it didn't see.

Your Avra team writes the prediction with you and checks it against your data before anything runs. Then it's [evaluated](/rfm/evaluation) on your history before anything goes live.

**[How predictions work](/rfm/predictions)**

What the model reads for each prediction

**[Evaluation](/rfm/evaluation)**

How a prediction proves itself on your history

**[Use cases](/use-cases)**

Predictions for acquisition, credit, and fraud
