简体   繁体   English

ml.projects.predict函数具有哪些参数,如何调用?

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

I trying to use this https://cloud.google.com/ml/reference/rest/v1beta1/projects/predict function. 我试图使用此https://cloud.google.com/ml/reference/rest/v1beta1/projects/predict函数。 By following this https://cloud.google.com/ml/docs/quickstarts/prediction example I uploaded deployable version of mnist code, created model and version for it. 通过遵循以下https://cloud.google.com/ml/docs/quickstarts/prediction示例,我上传了mnist代码的deployable版本,并为其创建了模型和版本。 Now I want to get some prediction results from it from python code. 现在,我想从python代码中获得一些预测结果。

By reading this function description I don't understand how I supposed to run it. 通过阅读此功能说明,我无法理解如何运行它。 I don't see where is it's parameters description and how they should look like. 我看不到参数说明在哪里以及它们的外观。

For example I used this code to create learning task: 例如,我使用以下代码创建学习任务:

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()

I were calling jobs.create function with parameters: parent and body . 我正在调用带有参数的job.create函数: parentbody I don't understand from the documentation what parameters is needed for projects.predict function and how to build them. 我从文档中无法理解projects.predict函数需要哪些参数以及如何构建它们。 There is written about output format, but input arguments skipped. 其中写有关于输出格式的信息,但是输入参数已跳过。

Perhaps you're confused because predict takes a wrapper as the argument, that HTTP body you see listed. 也许您很困惑,因为predict包装器作为参数,即列出的HTTP正文。 This is the wrapper, in HTTP request format, containing a list of instances. 这是HTTP请求格式的包装,包含实例列表。 The format of the instances is determined by the model you built; 实例的格式由您建立的模型决定; predict is simply a communication channel. 预测仅仅是一个沟通渠道。 You put that after "?data=" in your prediction request. 您将其放在预测请求中的“?data =“之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM