Skip to content
Science templates

Predictive modelling — split before learning

Preserve an untouched evaluation set and fit preprocessing only within training folds. Feature selection, imputation and tuning can leak outcome information if performed before splitting.

Template previewScience
Rendering…

What this template contains

Source
24 lines

Make it your own.

{
  "nodes": [
    { "id": "data", "type": "rounded", "label": "Eligible labelled observations", "x": 40, "y": 200, "width": 150, "height": 104, "fill": "#ede9fe", "stroke": "#6d28d9" },
    { "id": "split", "type": "octagon", "label": "Group / time-aware split", "x": 215, "y": 200, "width": 150, "height": 104, "fill": "#e0f2fe", "stroke": "#0369a1" },
    { "id": "train", "type": "cylinder", "label": "Training folds", "x": 390, "y": 40, "width": 150, "height": 104, "fill": "#dbeafe", "stroke": "#1d4ed8" },
    { "id": "test", "type": "cylinder", "label": "Untouched evaluation set", "x": 390, "y": 360, "width": 150, "height": 104, "fill": "#dbeafe", "stroke": "#1d4ed8" },
    { "id": "prep", "type": "rounded", "label": "Fit preprocessing inside each fold", "x": 565, "y": 40, "width": 150, "height": 104, "fill": "#fef3c7", "stroke": "#b45309" },
    { "id": "tune", "type": "rounded", "label": "Tune candidate models", "x": 740, "y": 40, "width": 150, "height": 104, "fill": "#fef3c7", "stroke": "#b45309" },
    { "id": "freeze", "type": "octagon", "label": "Freeze pipeline and choices", "x": 740, "y": 200, "width": 150, "height": 104, "fill": "#e0f2fe", "stroke": "#0369a1" },
    { "id": "eval", "type": "card", "label": "Evaluate once on held-out rows", "x": 740, "y": 360, "width": 150, "height": 104, "fill": "#ccfbf1", "stroke": "#0f766e" },
    { "id": "report", "type": "rounded", "label": "Performance and scope", "x": 915, "y": 200, "width": 150, "height": 104, "fill": "#fce7f3", "stroke": "#be185d" }
  ],
  "edges": [
    { "id": "e0", "source": "data", "target": "split", "label": "partition" },
    { "id": "e1", "source": "split", "target": "train", "label": "development" },
    { "id": "e2", "source": "split", "target": "test", "label": "evaluation" },
    { "id": "e3", "source": "train", "target": "prep", "label": "fit transformations" },
    { "id": "e4", "source": "prep", "target": "tune", "label": "cross-validate" },
    { "id": "e5", "source": "tune", "target": "freeze", "label": "choose" },
    { "id": "e6", "source": "freeze", "target": "eval", "label": "apply frozen pipeline" },
    { "id": "e7", "source": "test", "target": "eval", "label": "unseen outcomes" },
    { "id": "e8", "source": "eval", "target": "report", "label": "estimate generalisation" }
  ]
}