ml.projects.predict 函数有哪些参数以及如何调用它?

What parameters ml.projects.predict function have and how to call it?

我正在尝试使用此 https://cloud.google.com/ml/reference/rest/v1beta1/projects/predict 功能。 按照这个 https://cloud.google.com/ml/docs/quickstarts/prediction 示例,我上传了 deployable 版本的 mnist 代码,为其创建了模型和版本。现在我想从 python 代码中得到一些预测结果。

通过阅读此函数描述,我不明白我应该如何 运行 它。我看不到它的参数说明在哪里以及它们应该是什么样子。

例如我使用这段代码来创建学习任务:

credentials = GoogleCredentials.get_application_default()
ml = discovery.build('ml','v1beta1', credentials=credentials)
projectID = 'projects/{}'.format('testml')
jobDict = { 'jobId': 'test_job_3', 'trainingInput': { 'scaleTier': 'BASIC', 'packageUris': [ 'gs://testml-ml/
cloudmldist/1479282298/trainer-0.0.0.tar.gz' ], 'pythonModule': 'trainer.task', 'args': [ '--train_dir=gs://testml-ml/
test_job3_results' ], 'region': 'us-central1' } }
request = ml.projects().jobs().create(parent = projectID, body = jobDict)
response = request.execute()

我使用参数调用 jobs.create 函数:parentbody。 我无法从文档中了解 projects.predict 函数需要哪些参数以及如何构建它们。有关于输出格式的文章,但跳过了输入参数。

也许您感到困惑,因为 predictwrapper 作为参数,即您看到的列出的 HTTP 正文。这是包装器,采用 HTTP 请求格式,包含实例列表。实例的格式由您构建的模型决定; predict 只是一个沟通渠道。您将其放在预测请求中的“?data=”之后。