liveBook · Manning

Validation

As explained in Machine Learning Platform Engineering

Model validation is the process of evaluating a trained machine learning model on data or tests intended to estimate its performance and suitability.

A model that scores well during training is not automatically ready to deploy. Evaluate it on data outside the training set to estimate performance on unseen inputs, then validate that its behavior meets the intended requirements. Evaluation can use precision, recall, or AUC; validation may also involve business stakeholders who did not build the model. section 1.1.1

In a production pipeline, make validation a repeatable component after training rather than a one-off notebook check. It should record metrics, expose degradation early, reveal differences across data segments, and inform deployment decisions. Historical results make later comparisons possible. Continuous retraining raises the stakes: robust data and model validation belong alongside pipeline monitoring and lineage. section 8.1.4 section 2.5.2

Validate an object detector in Kubeflow Pipelines

Define a KFP `@dsl.component` with a data-configuration artifact, trained model, validation dataset, and `Output[Metrics]`. Load `best.pt` with Ultralytics `YOLO`, run `model.val` against `data.yaml`, and log `map50-95`, `map50`, and `map75`. A prepackaged Ultralytics image supplies the main ML dependencies; install the remaining packages explicitly. This keeps validation integrated with training while leaving room for custom checks. section 8.1.4

Listing 8.13 Loading the YOLO model and computing validation metrics
@dsl.component(...)
def validate_model(...):
   from ultralytics import YOLO
   import os

   model_path = os.path.join(model.path, "best.pt") #1
   model = YOLO(model_path)

   val_results = model.val( #2
       data=os.path.join(data_yaml.path, "data.yaml"),
       imgsz=640,
       batch=1,
       verbose=True
   )

   metrics.log_metric("map50-95", val_results.box.map) #3
   metrics.log_metric("map50", val_results.box.map50)   #3
   metrics.log_metric("map75", val_results.box.map75)   #3

The listing shows the concrete handoff from a trained YOLO artifact to validation results and KFP metric logging. section 8.1.4

Artifact access is an integration choice. With a persistent volume claim mounted into the validation step, model weights can be loaded from the mount instead of fetched through additional MinIO code. The pipeline still orders validation after training and passes the training outputs into the validation operation. section 9.1.7

The same component pattern can support a movie recommender, but its validation strategy and metrics must suit that task. Keep data-quality checks, model training, metric definition, and experiment tracking distinct. Validating incoming data is not a substitute for validating the trained model. section 9.3

Validation has a different boundary in an LLM application: input guards sanitize queries, while output guards check responses before users see them. Because multiple responses to one prompt can be valid, exact-match assertions alone are insufficient; evaluate semantic quality, factual accuracy, and safety, and probe vulnerabilities before deployment. section 13.3.1 section 13.5

How Machine Learning Platform Engineering covers it

How deep it goes
Works through a KFP component that runs YOLO validation and logs metrics; leaves custom validation logic open to evolving requirements.
Examples
Uses YOLO object-detection metric logging, PVC-mounted model weights, and a movie-recommender training workflow.
What it assumes
Builds on prepared data and trained-model artifacts; introduces the validation component and its pipeline integration step by step.
What you can do after
Build it from scratch as a KFP validation component that loads a trained YOLO model and records validation metrics.
How it connects
Connects validation to model evaluation, data quality, continuous retraining, experiment tracking, and pipeline monitoring.

Also explained in

Compare how 30 books explain validation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Platform Engineering. The section links point to the parts of the book it draws on.