Bentrix Docs
HomePricingDashboard

Evaluating a policy honestly

Why a policy's training reward misleads, how to split episodes, how many seeds to use, why the interquartile mean, and the baselines to beat.

A trained policy always looks good on the episodes it trained on. Whether it is any good is a different question, and the answer comes only from episodes it never saw, scored with care.

01Three sets of episodes

SetUsed toNever used to
trainingupdate the policyjudge it
validationchoose between policies, settings, rewardsreport a result
testreport the result, oncechoose anything

A seed used to choose a policy is no longer a test seed: the choice fitted it. Every time you look at the test score and change something, the test set becomes a validation set — keep a fresh one for the end.

02Split by time, too

Seeds draw windows from the whole recording, so training and test windows interleave in time and share the same market regime. A stricter test uses a later stretch than anything trained on: train on the first part of the recording, then test with your own start_ms on the last part (episodes and seeds). A policy that survives that has learned something about the market, not about a few weeks.

03Enough seeds

One episode is an anecdote. Results vary a great deal from one window to the next, so:

  • use ten test seeds at least — bentrix.gym.evaluate says so in too_few_seeds when there are fewer;
  • report the spread, not only the centre: the interval, or every score.

04The interquartile mean

evaluate reports the IQM — the mean of the middle half of the scores, a quarter cut from each end. A mean is moved by one lucky or unlucky window; a median throws most of the scores away. The IQM keeps half of them and ignores the extremes, which is why it has become the standard way to report reinforcement-learning results. Its interval comes from a bootstrap: the scores resampled 2,000 times, with a fixed generator so the report is reproducible.

05Baselines to beat

A score means nothing alone. Every evaluation should include, on the same seeds:

BaselineWhy
flat — never tradescores 0; a policy below it loses to doing nothing
always long / always shortshows how much of a score is just the market's drift over those windows
a simple rulea momentum or mean-reversion rule (a rule to beat); a network that cannot beat it has learned nothing worth its cost
randoman agent no better than random choices has not learned the task

06Costs are already in

The venue charges the spread, the commission and the swap, so every reward is after costs — and a policy that changes side often pays for it. Compare how often policies trade, not only what they score: two policies with equal scores and very different trade counts are not equal.

07Prove the run

Record each test episode's seed, its actions and its ledger hash. Anyone with the same recording can replay them and get the same hash — or find out they cannot.

08What a result is not

A good test score is evidence that a policy did well on those windows of that recording, under that venue's costs. It is not a forecast. Markets change, and the laboratory measures what happened, not what will.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed