Setting up HPT jobs on Vertex AI
In this section, we will learn how to set up HPT jobs with Vertex AI. We will use the same neural network model experiment from Chapter 7, Training Fully Custom ML Models with Vertex AI, and optimize its hyperparameters to get the best model settings.
The first step is to create a new Jupyter Notebook in Vertex AI Workbench and import useful libraries:
import numpy as np import glob import matplotlib.pyplot as plt import os import google.cloud.aiplatform as aiplatform from google.cloud.aiplatform import hyperparameter_tuning as hpt from datetime import datetime TIMESTAMP = datetime.now().strftime("%Y%m%d%H%M%S") %matplotlib inline
Next, we set up project configurations:
PROJECT_ID='************' REGION='us-west2' SERVICE_ACCOUNT='417xxxxxxxxx7-compute@developer.gserviceaccount.com' BUCKET_URI='gs://my-training-artifacts'
Then, we initialize the Vertex AI SDK:
aiplatform.init(project=PROJECT_ID...