【问题标题】:Bulk prediction Google Prediction API批量预测 Google Prediction API
【发布时间】:2015-04-12 05:13:35
【问题描述】:

有没有办法使用 Google Prediction API(大约 100 MB)批量预测大量数据?我发现可以使用存储在 Google Cloud Storage 上的数据来训练模型。是否可以根据存储在 Google Cloud Storage 上的文件进行预测?

【问题讨论】:

    标签: google-prediction


    【解决方案1】:

    是的,这行得通。我在下面为您准备了一个 Python 代码示例。

    # Get predefined credentials (see https://cloud.google.com/sdk/gcloud/#gcloud.auth)
    http = AppAssertionCredentials('https://www.googleapis.com/auth/prediction').authorize(httplib2.Http())
    
    # Create a service for the Prediction API
    service = build('prediction', 'v1.6', http=http)
    
    # Define body to create a new model with a URL to the CSV files stored in GCP Cloud Storage
    request_body = {"id": "<ModelID>", "storageDataLocation": <bucket_with_filename>}
    
    # Execute command
    return service.trainedmodels().insert(project='<ProjectID>', body=request_body).execute()
    

    【讨论】:

    猜你喜欢
    • 2011-04-12
    • 2017-06-13
    • 1970-01-01
    • 2019-08-24
    • 1970-01-01
    • 2019-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多