exam questions

Exam DP-100 All Questions

View all questions & answers for the DP-100 exam

Exam DP-100 topic 4 question 6 discussion

Actual exam question from Microsoft's DP-100
Question #: 6
Topic #: 4
[All DP-100 Questions]

HOTSPOT -
You deploy a model in Azure Container Instance.
You must use the Azure Machine Learning SDK to call the model API.
You need to invoke the deployed model using native SDK classes and methods.
How should you complete the command? To answer, select the appropriate options in the answer areas.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: from azureml.core.webservice import Webservice
The following code shows how to use the SDK to update the model, environment, and entry script for a web service to Azure Container Instances: from azureml.core import Environment from azureml.core.webservice import Webservice from azureml.core.model import Model, InferenceConfig
Box 2: predictions = service.run(input_json)
Example: The following code demonstrates sending data to the service: import json test_sample = json.dumps({'data': [
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
]})
test_sample = bytes(test_sample, encoding='utf8')
prediction = service.run(input_data=test_sample)
print(prediction)
Reference:
https://docs.microsoft.com/bs-latn-ba/azure/machine-learning/how-to-deploy-azure-container-instance https://docs.microsoft.com/en-us/azure/machine-learning/how-to-troubleshoot-deployment

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
rishi_ram
Highly Voted 1 year ago
Question was there in June 2021 Exam
upvoted 12 times
...
1q2w3e4r5t
Highly Voted 9 months, 2 weeks ago
given answer is correct
upvoted 9 times
...
punz61
Most Recent 1 month, 3 weeks ago
given answer is correct
upvoted 2 times
...
synapse
3 months ago
Given answer is correct. https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.webservice(class)?view=azure-ml-py#azureml-core-webservice-run
upvoted 2 times
...
AjoseO
3 months, 1 week ago
On Exam: 03 March 2022
upvoted 5 times
...
hargur
7 months, 3 weeks ago
on 19Oct2021
upvoted 2 times
...
azurecert2021
11 months, 3 weeks ago
First option is correct for sure but second is wrong You deploy a model in Azure Container Instance so it is already deployed! You must use the Azure Machine Learning SDK to call the model API so here ask is how to call ? You need to invoke the deployed model using native SDK classes and methods ,again we need to invoke remember! so second answer should be prediction = requests.post(service.scoring_uri, input_json)
upvoted 5 times
ning
2 days, 21 hours ago
Answer is correct! WebService is not the same as normal web request, class definition here: https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.webservice(class)?view=azure-ml-py#azureml-core-webservice-run
upvoted 1 times
...
SnowCheetah
11 months, 3 weeks ago
The Answer is already correct with Webservice and run() https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.webservice(class)?view=azure-ml-py in Webservice have method call run() to call webservice with an input. It should do the same functionality as requests.post(service.scoring_uri, input_json). I believe that prediction = requests.post(service.scoring_uri, input_json) should not work because of the upper provided code is not include "import requests" to be able running post method.
upvoted 10 times
Maunik
11 months ago
Given answer in correct: https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/deployment/deploy-to-cloud/model-register-and-deploy.ipynb
upvoted 3 times
...
...
dda711
7 months ago
requests is not a native SDK class either
upvoted 3 times
...
pancman
2 months ago
You are mistaken; requests is a python library, which is not part of zure ML SDK. Webservice is part of SDK. The run method of Webservice calls the Webservice with the provided input. And the input parameter is the data your machine learning model expects as an input to run predictions. Here in the correct answer, we feed the json data as the input.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago