利用Vertex AI进行定制化机器学习模型训练与可解释性分析
1. 利用Vertex AI评估训练好的模型
在能够启动Vertex AI训练、监控训练过程并保存TensorFlow训练的模型后,接下来进入模型评估阶段。以下是具体的操作步骤:
1. 加载测试数据 :将测试数据加载到Jupyter Notebook中。
from io import BytesIO
import numpy as np
from tensorflow.python.lib.io import file_io
dest = 'gs://data-bucket-417812395597/'
test_x = np.load(BytesIO(file_io.read_file_to_string(dest+'test_x', binary_mode=True)))
test_y = np.load(BytesIO(file_io.read_file_to_string(dest+'test_y', binary_mode=True)))
print(test_x.shape, test_y.shape)
- 创建JSON负载实例 :从测试数据中创建实例的JSON负载,并将其保存到云存储位置。
import json
BATCH_PREDICTION_INSTANCES_FILE = "batch_prediction_