Capstone Project · Lesson 84

Tune Hyperparameters

Hyperparameter tuning searches model/preprocessing settings using only development-validation information.

ConceptWorked examplePracticeKnowledge check
Textbook walkthrough

Tune Hyperparameters

Hyperparameter tuning searches model/preprocessing settings using only development-validation information. It is part of model selection and therefore must not repeatedly inspect the final test set.

Learning goal: explain why Tune Hyperparameters behaves this way, apply it to a small example, and verify the result independently. Begin by being able to justify this first step: Define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration.

Deeper walkthrough

Read Tune Hyperparameters as a mechanism, not a recipe

Treat this as a sequence of observable decisions rather than one opaque command. Stage 1: Define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration. Stage 2: Keep the stage inside the same data/validation definitions used by the rest of the project. Stage 3: Save the evidence produced by this stage so the next stage can be audited.

Mechanism

Follow the transformation

Define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration.

Keep the stage inside the same data/validation definitions used by the rest of the project.

Save the evidence produced by this stage so the next stage can be audited.

Evidence

Know what would convince you

  • Confirm fitted transformations/models saw only training data.
  • Retain fold/test predictions so metrics can be recomputed independently.
Useful distinctionTraining evidence: Information allowed to influence fitted state.
Click a stage to inspect what happens, what changes, and what should be checked before moving on.
Stage 1

Define a plausible search space

Define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration.

Transformation focus: keep the input and produced parameters/result separate so the change is observable and reproducible.
How it works

Trace the mechanism step by step

  1. Define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration.
  2. Keep the stage inside the same data/validation definitions used by the rest of the project.
  3. Save the evidence produced by this stage so the next stage can be audited.
Worked demonstration

Tune Hyperparameters evidence

Tune Hyperparameters evidence
Evidence: the best configuration is selected from CV/validation results and the test labels have not been used.
Expected / illustrative result
The worked evidence makes the output of this project stage concrete and auditable.
Interpret the result.

For Tune Hyperparameters, trace the specific input through the mechanism above and independently verify one returned value, state change or side effect.

Distinctions & related ideas

Place the concept correctly

Training evidenceInformation allowed to influence fitted state.
Held-out evidenceIndependent observations used to estimate generalisation.
InterpretationWhat the result supports, with assumptions and limitations.
Use deliberately

When it is appropriate

Use Tune Hyperparameters when it answers a defined question in Capstone Project and its inputs/assumptions match the current data or program state.

Boundary conditions

When to stop or reconsider

Reconsider Tune Hyperparameters when the required information is unavailable, the operation would violate a validation/data boundary, or a simpler operation answers the question more transparently.

Common mistakes

Failure modes to recognise

  • Learning preprocessing/feature/model choices from held-out test information.
  • Comparing models under different splits or preprocessing and attributing the difference to the algorithm.
  • Turning an association or model explanation into an unsupported causal claim.
Verification

How to check the result

  • Confirm fitted transformations/models saw only training data.
  • Retain fold/test predictions so metrics can be recomputed independently.
  • Inspect errors/subgroups and compare with a baseline before generalising the conclusion.
Hands-on practice

Demonstrate understanding

Try this:

Construct a tiny example of Tune Hyperparameters. First define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration. Then keep the stage inside the same data/validation definitions used by the rest of the project. Predict the result before execution and explain one boundary or failure case.

List the stage inputs and expected artifact, rerun it from a clean state, and compare against a concrete acceptance check.
Knowledge check

Check reasoning, not memorisation

Which approach best demonstrates understanding of Tune Hyperparameters?

Quick reference

Remember the logic

Step 1Define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration.
Step 2Keep the stage inside the same data/validation definitions used by the rest of the project.
Step 3Save the evidence produced by this stage so the next stage can be audited.
Lesson summary

What to remember

  • Hyperparameter tuning searches model/preprocessing settings using only development-validation information. It is part of model selection and therefore must not repeatedly inspect the final test set.
  • Define a plausible search space, run search around the full pipeline, choose the objective/constraints in advance and record the selected configuration.
  • Learning preprocessing/feature/model choices from held-out test information.
  • Confirm fitted transformations/models saw only training data.