liveBook · Manning

Chapter 7: Data analysis and preparation

What you will learn in chapter 7 of Machine Learning Platform Engineering

This introduction explains why data preparation matters and previews how Kubeflow notebooks and pipelines will be used for two capstone ML projects.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction explains why data preparation matters and previews how Kubeflow notebooks and pipelines will be used for two capstone ML projects.

Key terms: data preparation, garbage in, garbage out, data quality, data integrity, Kubeflow notebooks, toy jokes pipeline, data passing, Kubeflow components, data preparation pipeline, reproducibility

7.1 Data analysis

This section explains the infrastructure needs of interactive ML data analysis and introduces Kubeflow notebooks as a way to meet them alongside production pipelines.

Key terms: data analysis, ad hoc interactive access, GPUs, deployment environment, CI/CD, Kubeflow notebooks, Jupyter Notebooks, VS Code, RStudio, base image

7.1.1 Launching a notebook server in Kubeflow

This section shows how to create a Kubeflow notebook and choose its namespace, image, and compute resources without unnecessarily tying up cluster capacity.

Key terms: Notebooks, NEW NOTEBOOK, Image, Kubernetes (K8s) Namespace, resource quotas, volume mounts, secrets, limits, requests, GPUs

7.1.2 Workspace and data volumes

Explains how Kubeflow notebooks use persistent workspace storage and optional data volumes, including when existing storage can be reused.

Key terms: workspace volume, data volumes, default storage class, Persistent Volume Claims (PVCs), /home/jovyan, Persistent Volume Claim (PVC), Persistent Volumes (PVs)

7.1.3 Configurations and affinity/tolerations

Explains how Kubeflow notebook launch settings configure a pod, influence its placement, and affect what happens when the notebook resource is changed.

Key terms: Configurations, PodDefaults, add-proxy-vars, env, MLFLOW_TRACKING_URI, affinity, tolerations, taints, GPUs, shared memory

7.1.4 Customizing the menu

Cluster administrators customize the Kubeflow notebook menu through a ConfigMap, controlling available images and notebook scheduling choices.

Key terms: ConfigMap, jupyter-web-app-config, spawnerFormDefaults, readOnly, image, imageGroupOne, imageGroupTwo, value, options, CD pipeline

7.1.5 Creating a custom Kubeflow notebook image

This section explains what a custom Kubeflow notebook image contains, how the provided Dockerfile builds one, and why custom images help teams move from local notebooks to Kubeflow.

Key terms: custom image, code-server, Jupyter, configuration files, Kubeflow, multistage Dockerfile, base image, image size, Kubeflow notebooks, local development workflow

7.2 Data passing

Introduces why data passing matters in Kubeflow Pipelines: components run in separate Kubernetes pods, so they need a way to share data in an ML workflow.

Key terms: KFP, components, K8s pod, data passing

7.2.1 Scenario 1: Passing simple values to downstream components

This section shows how a Kubeflow pipeline passes simple return values between components and explains how those components are packaged and executed.

Key terms: generate_joke, count_words, output attribute, KFP, @dsl.component, packages_to_install, base_image, pyjokes, Docker container, joke_pipeline.yaml

7.2.2 Scenario 2: Passing paths for larger data

This section explains why KFP components should pass paths to file-backed artifacts for larger data, shows that pattern in a three-component pipeline, and contrasts KFP v2 artifact types with v1 path conventions.

Key terms: K8s pod, memory limit, OOMKilled, file or directory, path, Output[Artifact], Input[Artifact], generate_joke, count_words, output_result

7.2.3 Overview of KFP v2 artifact types

This section explains how to choose KFP v2 artifact types for pipeline data, models, metrics, reports, and other outputs.

Key terms: KFP v2, artifact types, metadata, data lineage, model provenance, Dataset, Input[Dataset], Output[Dataset], data splits, Model

7.3 Data preparation in action

This section previews how data preparation for two capstone projects will become a Kubeflow pipeline built from reusable components.

Key terms: data preparation, Kubeflow component, training, test, and validation datasets, executable pipeline, KFP, composable, well-defined Kubeflow components, customize

7.3.1 Data preparation: Object detection

This section builds and runs a Kubeflow data-preparation pipeline that downloads an ID-card dataset, organizes it for YOLOv8, splits it, and checks the results.

Key terms: Ultralytics YOLO format, images, labels, names, id_card, MIDV-500, tarfile, MinIO, bucket, boto3

7.3.2 Data preparation: Movie recommender

This section builds a MovieLens data preparation pipeline in Kubeflow, using reusable components to produce Parquet datasets, upload them to MinIO, and check the results.

Key terms: MovieLens 25M, Dataset download component, Data unzip component, CSV to Parquet conversion component, Dataset split component, MinIO upload component, Dataset artifacts, path attribute, InputPath, OutputPath

7.4 Summary

The chapter summary connects Kubeflow notebooks, component data passing, and pipeline assembly to the data preparation needed for the object detector and movie recommender projects.

Where this is used later

Concepts explained in this chapter

← Chapter 6: Productionizing ML models Chapter 8: Model training and validation: Part 1 →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.