liveBook · Manning

Model training script

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

A program file containing the code and configuration needed to train a machine-learning model.

A model training script is a Python program that turns prepared data and configuration into a trained machine-learning model. In a Vertex AI pipeline, it replaces an interactive notebook and runs inside a container, where Cloud Storage URIs and pipeline-provided environment variables supply its inputs and output location. section 11.3.1 section 11.3.4

Adapting notebook code into a container-ready training script typically involves:

  • Removing notebook-only work, such as model diagrams, and leaving the code required for training. section 11.3.5
  • Accepting runtime arguments, such as the Cloud Storage URI for a YAML training configuration. section 11.3.5
  • Downloading the configuration from Cloud Storage rather than reading the local filesystem. section 11.3.4 section 11.3.5
  • Reading training, validation, and test data through AIP environment variables, matching CSV files, and merging them into dataframes. section 11.3.5
  • Saving the trained model to the AIP_MODEL_DIR location supplied by Vertex AI. section 11.3.5

From property-price notebook to pipeline job

A notebook that predicts Kuala Lumpur property prices can become a training script by removing its dataset-splitting and visualization code, loading configuration through a --config_bucket argument, assembling CSV subsets from Cloud Storage, and saving the trained model to the pipeline output URI. A pipeline script then creates the container, invokes training, and supports deployment to a Vertex AI endpoint. section 11.3.1 section 11.3.5

Figure 11.28 Training on a local system vs. training with an ML pipeline

Compare local training with pipeline training to see how responsibility shifts from manual file handling and deployment to containerized execution and Vertex AI orchestration. section 11.3.1

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Descends from notebook conversion to argument parsing, Cloud Storage access, environment variables, dataframe assembly, and model output.
Examples
Uses Kuala Lumpur property-price prediction, CSV dataset subsets, YAML configuration, AIP variables, and Keras model saving.
What it assumes
Assumes a working notebook-based training workflow and introduces the Cloud Storage and container changes needed for pipeline execution.
What you can do after
Build container-compatible training code that consumes pipeline inputs and writes a model for Vertex AI deployment.
How it connects
Links machine-learning pipelines with containers, Cloud Storage, Vertex AI SDKs, model registries, and endpoints.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.