【发布时间】:2023-03-04 18:30:01
【问题描述】:
我正在使用 GCP 中使用 Vertex 的 Tabular automl 训练的模型。 训练和批量预测工作正常。我正在尝试在可视化中使用特征重要性并尝试从 python 中获取它们。 我可以使用 @Ricco D 为我发布的代码进行模型评估:
api_endpoint = 'us-central1-aiplatform.googleapis.com'
client_options = {"api_endpoint": api_endpoint} # api_endpoint is required for client_options
client_model = aiplatform.services.model_service.ModelServiceClient(client_options=client_options)
project_id = 't...1'
location = 'us-central1'
model_id = '6...2'
model_name = f'projects/{project_id}/locations/{location}/models/{model_id}'
list_eval_request = aiplatform.types.ListModelEvaluationsRequest(parent=model_name)
list_eval = client_model.list_model_evaluations(request=list_eval_request)
for val in list_eval:
print(val.model_explanation)
但我不知道如何获得在训练管道中生成的训练模型的特征重要性。我可以在模型页面上看到它们,但无法从 python 访问它们:
代码返回的ListModelEvaluationsPager对象是这样的:
name: "projects/7...3/locations/us-central1/models/6...2/evaluations/5...0"
metrics_schema_uri: "gs://google-cloud-aiplatform/schema/modelevaluation/regression_metrics_1.0.0.yaml"
metrics {
struct_value {
fields {
key: "meanAbsoluteError"
value {
number_value: 27.391115
}
}
fields {
key: "meanAbsolutePercentageError"
value {
number_value: 25.082605
}
}
fields {
key: "rSquared"
value {
number_value: 0.88434035
}
}
fields {
key: "rootMeanSquaredError"
value {
number_value: 47.997845
}
}
fields {
key: "rootMeanSquaredLogError"
value {
number_value: nan
}
}
}
}
create_time {
seconds: 1630550819
nanos: 842478000
}
}
>```
This object does not have a model_explanation member and the code returns an error
【问题讨论】:
标签: google-cloud-platform google-cloud-automl google-ai-platform