[英]How to create a dataset with google cloud AutoML
Silly question, but I'm new to Python and Google Cloud.愚蠢的问题,但我是 Python 和 Google Cloud 的新手。 I'm trying to predict customer-lifetime-value with google cloud automl_v1beta1, the code is here
我正在尝试使用 google cloud automl_v1beta1 预测客户生命周期价值,代码在这里
from google.cloud.automl_v1beta1 import AutoMlClient, PredictionServiceClient from google.cloud_v1beta1 import automl client = AutoMlClient.from_service_account_file(keyfile_name) location_path = f"projects/{project_id}/locations/us-central1" dataset_display_name = automl_dataset # create dataset create_dataset_response = client.create_dataset( parent=location_path, dataset={'display_name': dataset_display_name, 'tables_dataset_metadata': {}})
and I received the following errors: \我收到以下错误:\
Traceback (most recent call last): File "/home/tensorflow-lifetime-value/clv_automl/test1.py", line 220, in <module> main() File "/home/tensorflow-lifetime-value/clv_automl/test1.py", line 193, in main model_name = create_automl_model(client, File "/home/tensorflow-lifetime-value/clv_automl/test1.py", line 48, in create_automl_model create_dataset_response = client.create_dataset( File "/home/.local/lib/python3.9/site-packages/google/cloud/automl_v1/services/auto_ml/client.py", line 623, in create_dataset request.dataset = dataset File "/usr/local/lib/python3.9/dist-packages/proto/message.py", line 757, in __setattr__ pb_value = marshal.to_proto(pb_type, value) File "/usr/local/lib/python3.9/dist-packages/proto/marshal/marshal.py", line 211, in to_proto pb_value = rule.to_proto(value) File "/usr/local/lib/python3.9/dist-packages/proto/marshal/rules/message.py", line 36, in to_proto return self._descriptor(**value) ValueError: Protocol message Dataset has no "tables_dataset_metadata" field.
I got the same error using your code when I used google-cloud-automl<=0.1.2
.当我使用
google-cloud-automl<=0.1.2
时,我使用您的代码遇到了同样的错误。 Your error will be fixed if you use google-cloud-automl>=0.1.2
.如果您使用
google-cloud-automl>=0.1.2
,您的错误将得到修复。 But I suggest to always install the latest version by doing pip install --upgrade google-cloud-automl
to maximize the latest updates from Google Cloud.但我建议始终通过执行
pip install --upgrade google-cloud-automl
来安装最新版本,以最大化来自 Google Cloud 的最新更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.