600 / 736FIT

Overfitting

Excessive fitting to development data

Overfitting occurs when rules adapt too closely to the details and noise of development data and transfer poorly to new observations. In trading it can affect both a model and selection among many strategies. An excellent historical result therefore requires a properly separated assessment of the entire procedure.

Overfitting is the adaptation of a model or decision rules to peculiarities of the available development sample at the expense of generalizing the relationship to further data. It also affects selection among candidates; quality cannot be judged solely by the result that simultaneously determined the winner.

QuantConnect describes Overfitting as fitting a limited training set too closely, capturing its details and noise at the expense of results on new data. Our distinction: the problem is not learning from history itself, but mistaking a property of a particular sample for a transferable regularity. In trading, even a manually assembled set of conditions can be overfit, rather than only a complex automated model. A handsome curve or good development-data score is therefore not yet independent confirmation of a procedure. [1]

The scikit-learn documentation shows the difference between an overly simple model unable to capture a relationship and a model sensitive to particular training samples. Our implication: parameter count alone is insufficient to diagnose overfitting. Simplifying or restricting a model’s flexibility can help, but can also remove a useful relationship. The decision should follow a predefined evaluation on suitable separate data. Even subsequently choosing the simplest variant based on an already inspected test does not restore that test’s independent role. [2]

Bailey and coauthors highlight false discoveries when strategies are repeatedly tried on the same data. Our methodological conclusion: record not only the winner’s parameters but also previous candidates, rule changes and the selection criterion. Even a simple final strategy can result from an extensive search. The selection pressure is not visible in its final description. The probability of overfitting cannot be determined from the number of variants alone; data, their dependencies and the search method also matter. [3]

The scikit-learn nested-validation example separates inner parameter selection from outer evaluation of the whole selection procedure. Using the same results both to choose and to present quality produces an overly optimistic score. Our requirement is to describe this boundary before the experiment and include preprocessing and metric choice in selection. If we further change the design based on the outer result, that information too has entered development. A nested structure does not permit repeated tuning against the same final test. [4]

The scikit-learn documentation warns that conventional splitting that assumes independent samples can distort generalization estimates for time-dependent data. Our trading-test check therefore preserves information order and examines whether every decision input and every target outcome used for training or rule selection was already available at the relevant time. A later period should not select a rule for an earlier moment. Walk-forward Analysis helps describe this sequence, but repeated adjustments to its protocol based on the same results are development again, rather than new independent evidence. [5]

scikit-learn requires learning transformations, such as normalization or feature selection, only on the training part before applying them to the test. Our distinction: leakage of unavailable information and overfitting are related but different problems. A strategy can fit noise without access to future rows; leakage can in turn produce an optimistic score even for a simple model. We therefore examine the whole procedure from data preparation to the final decision, rather than only the table split. [6]

Validation and learning curves in scikit-learn compare behavior on training and validation parts as settings or data quantity change. Our interpretation boundary: poorer subsequent performance alone does not prove a single cause. Markets, data quality or execution costs may change; chance can affect a short segment. We examine stability around neighboring settings and differences in conditions, but record every new search after viewing results. We do not present diagnosis as automatic statistical certification. [2]

NFA warns that hypothetical results are not actual trading and cannot fully capture liquidity, slippage or reactions to real losses. Our report therefore separates development and subsequent results and states all known trials, costs and data limitations. Any further assessment must have its rules recorded before it begins. Lower methodological-error risk is not the same as a demonstrated trading edge. Even previously unused data cannot guarantee a result under future market conditions. [7]

ExampleEXAMPLE · FIT

The selection winner need not win the subsequent test

Our fictional example has three predetermined candidates A, B and C with the same fixed size. Their net modeled results across three selection periods are A [8, 10, 12] USD, B [6, 8, 10] USD and C [4, 6, 8] USD. Totals in A, B, C order are [30, 24, 18] USD. The predefined rule chooses the largest selection total, breaking ties in favor of the first candidate in that order; it therefore selects A before the following periods begin. Only then do we reveal results for three subsequent test periods: A [-6, -4, -2] USD, B [1, 2, 3] USD and C [0, 1, 2] USD. Their test totals are [-12, 6, 3] USD. Selected A therefore earns -12 USD in the test. Starting test cash of 1000 USD ends at 988 USD. Selection profit of 30 USD is not added to that cash. Size is fixed, the stated amounts already include all modeled costs, and no position remains open at the end of any period; we assume no debt or external cash flows. The diagram compares each candidate’s selection and subsequent totals. B’s victory visible in hindsight does not allow the original choice of A to be rewritten. The example shows failure of the selection ranking to transfer, but does not itself prove overfitting as the sole cause or estimate its probability. These are not actual market results or instructions to choose a particular strategy.

For the clearest picture, read this entry together with Backtesting, Walk-forward Analysis, Look-ahead Bias, Paper Trading, Trading Journal. The reverse links also lead from Technical analysis, Technical indicator, Moving average crossover, Relative Strength Index.

01Can a simple strategy also be overfit?

Yes. A simple final rule may have been selected from many attempts based on the same data. The entire search process matters, rather than just the number of parameters in the published version.

02Does every poor subsequent result prove overfitting?

No. It may also relate to market changes, costs, faulty data or a short random segment. The methodology and conditions must be examined; a single performance difference determines neither the cause nor the probability of overfitting.

DOC · 001QuantConnect — Optimization ParametersDocumentation DOC · 002scikit-learn — Validation and Learning CurvesDocumentation DOC · 003Bailey et al. — The Probability of Backtest OverfittingPrimary DOC · 004scikit-learn — Nested versus Non-nested Cross-validationDocumentation DOC · 005scikit-learn — Cross-validation: Evaluating Estimator PerformanceDocumentation DOC · 006scikit-learn — Common Pitfalls: Data LeakageDocumentation DOC · 007NFA — Use of Promotional Material Containing Hypothetical Performance ResultsDocumentation
Revised: Source-first · No investment advice