---
title: How predictions work
description: What Avra RFM reads for each prediction — the record's related rows and labelled examples from your history — and how time keeps the future out of view.
---

Avra RFM predicts in context. For each prediction, it reads two things from your data as they stood on the prediction date: the rows related to the record it's scoring, and labelled examples from your own history, records like it and what happened to them. Then it returns a score. Nothing is trained in between, and the model's weights don't change.

## What the model reads

<svg class="fig" viewBox="0 0 640 300" role="img" aria-label="Top left, the record being scored, customer C1, with its accounts and payments; one payment recorded after the prediction date is hidden. Bottom left, labelled examples from earlier dates: other customers and whether they churned. Both feed Avra RFM, which returns a score.">
  <defs>
    <marker id="fig-context-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="card" x="16" y="16" width="328" height="132" rx="8" />
  <text class="small title" x="30" y="38">The record and its related rows</text>
  <line class="edge-accent" x1="80" y1="98" x2="160" y2="70" />
  <line class="edge-accent" x1="80" y1="98" x2="160" y2="124" />
  <line class="edge-accent" x1="160" y1="70" x2="240" y2="56" />
  <line class="edge-accent" x1="160" y1="70" x2="240" y2="94" />
  <line class="edge dash faint" x1="160" y1="124" x2="240" y2="126" />
  <circle class="solid" cx="80" cy="98" r="16" />
  <text class="mono mid on-solid" x="80" y="102">C1</text>
  <circle class="soft" cx="160" cy="70" r="14" />
  <text class="mono mid" x="160" y="74">A1</text>
  <circle class="soft" cx="160" cy="124" r="14" />
  <text class="mono mid" x="160" y="128">A2</text>
  <circle class="node" cx="240" cy="56" r="13" />
  <text class="mono mid" x="240" y="60">P1</text>
  <circle class="node" cx="240" cy="94" r="13" />
  <text class="mono mid" x="240" y="98">P2</text>
  <circle class="node dash faint" cx="240" cy="126" r="13" />
  <text class="mono mid faint" x="240" y="130">P3</text>
  <text class="small label" x="260" y="130">recorded later</text>
  <rect class="card" x="16" y="160" width="328" height="124" rx="8" />
  <text class="small title" x="30" y="182">Labelled examples from earlier dates</text>
  <circle class="solid" cx="38" cy="204" r="7" />
  <text class="mono small" x="54" y="208">C7 · Jul 1</text>
  <line class="rule dash" x1="150" y1="204" x2="268" y2="204" />
  <text class="mono small accent end" x="330" y="208">churned</text>
  <circle class="solid" cx="38" cy="230" r="7" />
  <text class="mono small" x="54" y="234">C3 · Jul 15</text>
  <line class="rule dash" x1="150" y1="230" x2="280" y2="230" />
  <text class="mono small label end" x="330" y="234">stayed</text>
  <circle class="solid" cx="38" cy="256" r="7" />
  <text class="mono small" x="54" y="260">C9 · Aug 1</text>
  <line class="rule dash" x1="150" y1="256" x2="280" y2="256" />
  <text class="mono small label end" x="330" y="260">stayed</text>
  <path class="edge" d="M344,82 C378,82 378,140 404,140" marker-end="url(#fig-context-arrow)" />
  <path class="edge" d="M344,222 C378,222 378,162 404,162" marker-end="url(#fig-context-arrow)" />
  <rect class="solid" x="408" y="122" width="120" height="56" rx="10" />
  <text class="mid on-solid title" x="468" y="155">Avra RFM</text>
  <line class="edge" x1="528" y1="150" x2="550" y2="150" marker-end="url(#fig-context-arrow)" />
  <rect class="soft" x="554" y="132" width="76" height="36" rx="18" />
  <text class="small mid" x="592" y="154">score</text>
</svg>

What the model reads for one prediction: the record's related rows as of the prediction date, and labelled examples of the same question from earlier dates. A row recorded after the prediction date stays out of view.

### The record and its related rows

The model starts from the record being scored and follows its keys across your tables: the customer's accounts, their payments, the products on its orders, the company that owns it, and rows further out. It reads them as they were on the prediction date, so a row recorded after that date stays out of view, even if it's in your database today. See [Relational data](/pt-BR/rfm/relational-data) for how keys and time shape what it can reach.

### Labelled examples

The model also reads examples of the same prediction at earlier dates: other records, the rows around them, and the outcome that followed. That's how it learns your question in context, what your outcome looks like in your data, without a training project. Examples come from the same population the prediction scores, so a prediction limited to active merchants learns from active merchants.

## In context, not trained

Because the examples are read when the prediction is made, a new question needs no training run: frame it, evaluate it on your history, and put the scores to work. The model's weights stay the same, and nothing about your business enters the shared model.

When an evaluation shows it's worth it, a copy of the model can learn from your data instead: adapted to your database, or fine-tuned on one task. The copy is exclusive to your workspace. See [Adaptation and fine-tuning](/pt-BR/rfm/adaptation).

## Time and leakage

Leakage happens when information from after a decision sneaks into the prediction. One rule prevents it: a prediction for a given date sees a row only if the row was known by that date, and a labelled example only once its outcome's window had closed by that date.

<svg class="fig" viewBox="0 0 640 280" role="img" aria-label="Five past prediction dates, from July 1 to September 1, each with a 28-day outcome window. The windows starting July 1, July 15, and August 1 close before September 10 and are shown as examples. The windows starting August 15 and September 1 are still open on September 10 and are never shown.">
  <defs>
    <marker id="fig-maturity-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>
  <line class="edge-accent" x1="466" y1="28" x2="466" y2="200" />
  <text class="small mid accent title" x="466" y="20">prediction date: Sep 10</text>
  <rect class="soft" x="40" y="40" width="168" height="16" rx="3" />
  <text class="mono small mid" x="124" y="52">Jul 1 → Jul 29</text>
  <rect class="soft" x="124" y="70" width="168" height="16" rx="3" />
  <text class="mono small mid" x="208" y="82">Jul 15 → Aug 12</text>
  <rect class="soft" x="226" y="100" width="168" height="16" rx="3" />
  <text class="mono small mid" x="310" y="112">Aug 1 → Aug 29</text>
  <rect class="node dash" x="310" y="130" width="168" height="16" rx="3" />
  <text class="mono small mid" x="394" y="142">Aug 15 → Sep 12</text>
  <rect class="node dash" x="412" y="160" width="168" height="16" rx="3" />
  <text class="mono small mid" x="496" y="172">Sep 1 → Sep 29</text>
  <line class="edge" x1="24" y1="200" x2="612" y2="200" marker-end="url(#fig-maturity-arrow)" />
  <line class="edge" x1="40" y1="195" x2="40" y2="205" />
  <text class="small label mid" x="40" y="220">Jul 1</text>
  <line class="edge" x1="226" y1="195" x2="226" y2="205" />
  <text class="small label mid" x="226" y="220">Aug 1</text>
  <line class="edge" x1="412" y1="195" x2="412" y2="205" />
  <text class="small label mid" x="412" y="220">Sep 1</text>
  <rect class="soft" x="40" y="238" width="22" height="12" rx="2" />
  <text class="small label" x="72" y="248">closed by the prediction date: shown as an example</text>
  <rect class="node dash" x="40" y="258" width="22" height="12" rx="2" />
  <text class="small label" x="72" y="268">still open on the prediction date: never shown</text>
</svg>

Which past outcomes a prediction dated September 10 can learn from, for a 28-day outcome. Outcomes whose window closed by September 10 are shown as examples; the two still open on that date are never shown.

Take a 28-day outcome. The outcome for a prediction dated August 1 was known on August 29, so a prediction for September 10 can learn from it. The outcome for August 15 isn't known until September 12, so on September 10 it doesn't exist yet, and it's never shown, even though your database holds it today.

A few more rules hold for every prediction. A row with no time, in a static table, is visible on every date, so static tables should hold only values that don't change. The outcome being predicted is never shown to the model, and neither is any other record's outcome from the same date. Each table declares how its time is read; see [What a table's time means](/pt-BR/rfm/relational-data#what-a-tables-time-means).

Backtests replay the same rules, so a result on your history is the result you would have seen at the time. See [Evaluation](/pt-BR/rfm/evaluation).

## What comes back

For a yes-or-no outcome, the RFM returns a score for each record; for a number, an estimate of the value. Each model version's schema lists exactly what it returns.

:::info
RFM scores rank and compare records; they aren't calibrated probabilities. Set thresholds and bands from your own outcomes. See [Risk bands](/pt-BR/use-cases/credit-intelligence/homogeneous-groups).
:::

## Getting predictions

Score one record at a time through the API with [live predictions](/pt-BR/core/predictions) when a decision comes up, or a whole portfolio on your schedule with [batch inference](/pt-BR/core/batch-inference). In your AWS account, predictions run as inference jobs on Amazon SageMaker. See [Avra RFM on AWS SageMaker](/pt-BR/deployment/aws-sagemaker).

**[What you can predict](/pt-BR/rfm/what-you-can-predict)**

Frame the records, the outcome, and the window

**[Adaptation and fine-tuning](/pt-BR/rfm/adaptation)**

When a copy of the model learns from your data

**[Evaluation](/pt-BR/rfm/evaluation)**

How every model proves itself before it decides anything
