我正在 Vertex AI 上使用 AutoML 进行预测建模,并获得了经过训练的模型。我在 Vertex AI 的模型选项卡中以图形方式检查了它的特征重要性,然后我想用下面的代码获得其特征重要性的文本数据,但只能看到它,不能将每个项目作为值。
------------------------ Python代码
from google.cloud import aiplatform_v1 as aiplatform2
api_endpoint = 'us-central1-aiplatform.googleapis.com'
client_options = {"api_endpoint": api_endpoint} # api_endpoint is required for client_options
client_model = aiplatform2.services.model_service.ModelServiceClient(client_options=client_options)
project_id = 'this is my project id'
location = 'us-central1'
model_id = 'my trained id'
model_name = f'projects/{project_id}/locations/{location}/models/{model_id}'
list_eval_request = aiplatform2.types.ListModelEvaluationsRequest(parent=model_name)
list_eval = client_model.list_model_evaluations(request=list_eval_request)
list_eval.model_evaluations
------------------------ 仅在笔记本上直观地获取此信息
[name: "projects/*********/locations/us-central1/models/*********/evaluations/*********"
metrics_schema_uri: "gs://google-cloud-aiplatform/schema/modelevaluation/regression_metrics_1.0.0.yaml"
metrics {
struct_value {
fields {
key: "meanAbsoluteError"
value {
number_value: 2863.7043
}
}
fields {
key: "meanAbsolutePercentageError"
value {
number_value: 197.63817
}
- - - - - - - - - - - - 问题
如何访问“键”及其“值”。示例键:“meanAbsoluteError”/值:number_value:2863.7043