Your company isan operator of wind farms in the North Sea.
The wind turbines are equipped with several sensors which regularly provide data about the status of the machinery.
You are going to introduce a predictive maintenance solution to reduce the failure rate of the machines.
As part of the solution, you have trained a machine learning model and deployed it as a web service.
The predictive maintenance application use this code to call the service with real-time data:
... # data from turbines x_new = [[0.8,2.8,4.0,3.0], [-0.2,3.8,3.9,2.1], [0.3,3.2,3.7,2.3]] # convert to JSON json_data = json.dumps({"data": x_new}) # Set the content type in the headers request_header = { 'Content-Type':'application/json' } # Call the service response = requests.post(url = endpoint, data = json_data, headers = request_headers) ... # Get the predictions from the JSON response predictions = json.loads(response.json())How can you retrieve the REST endpoint of the deployed service?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer: C.
Answer: C Option D is incorrect because endpoint is not a valid attribute of the Webservice object.
Reference:
The correct answer to retrieve the REST endpoint of the deployed service is C. endpoint = service.scoring_uri
.
Explanation:
In the provided code, requests.post()
method is used to call the deployed machine learning model as a web service with real-time data. This method requires the REST endpoint of the deployed service as a parameter. The endpoint is used to send the request to the deployed service.
To retrieve the REST endpoint of the deployed service, we need to use the scoring_uri
attribute of the service
object. This attribute contains the URL of the REST endpoint that can be used to send requests to the deployed service.
Therefore, the correct code to retrieve the REST endpoint of the deployed service is:
pythonendpoint = service.scoring_uri
Option A, service.deploy_configuration()
, is incorrect because this method is used to get or set the deployment configuration of the Azure Machine Learning service.
Option B, endpoint = service.location
, is incorrect because this attribute returns the location of the Azure Machine Learning service, not the REST endpoint of the deployed service.
Option D, endpoint = service.endpoint
, is incorrect because this attribute returns the endpoint of the Azure Machine Learning service, not the REST endpoint of the deployed service.