nerdexam
MicrosoftMicrosoft

DP-100 · Question #226

DP-100 Question #226: Real Exam Question with Answer & Explanation

This question tests the understanding of the standard function names required in an Azure Machine Learning entry script for real-time model deployment, specifically for model initialization and request processing.

Train and deploy models

Question

Drag and Drop Question You use Azure Machine Learning to deploy a model as a real-time web service. You need to create an entry script for the service that ensures that the model is loaded when the service starts and is used to score new data as it is received. Which functions should you include in the script? To answer, drag the appropriate functions to the correct actions. Each function may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point. Answer:

Explanation

This question tests the understanding of the standard function names required in an Azure Machine Learning entry script for real-time model deployment, specifically for model initialization and request processing.

Approach. To correctly answer this question, the test-taker must understand the lifecycle of an Azure Machine Learning real-time web service and the roles of specific functions within its entry script.

  • For the action 'Load the model when the service starts.', the correct function is 'init()'. The 'init()' function is executed once when the web service container or endpoint starts. Its primary purpose is to perform one-time setup tasks, such as loading the machine learning model into memory. Loading the model during initialization prevents it from being reloaded for every incoming request, which significantly improves the latency and throughput of the service.
  • For the action 'Use the model to score new data.', the correct function is 'run()'. The 'run()' function is the core of the real-time inference service. It is called every time an incoming request is received by the web service. This function takes the input data from the request, processes it using the model that was loaded by 'init()', performs predictions, and returns the results to the client. It handles the dynamic aspect of scoring new data as it arrives.

Common mistakes.

  • common_mistake. - Dragging 'main()' to either action is incorrect because 'main()' is not a standard entry point function used by Azure Machine Learning for real-time inference entry scripts. Its common use is as the main execution point for standalone Python scripts, not for web service handlers.
  • Dragging 'score()' or 'predict()' to 'Use the model to score new data.' is incorrect. While these terms describe the action of the model, 'run()' is the specific and expected function name that Azure Machine Learning invokes for processing inference requests in a deployed web service. Although a model object might have a 'predict()' or 'score()' method, the entry script's handler function for incoming requests must be named 'run()'. Using 'score()' or 'predict()' as the main handler would prevent the service from processing requests correctly. Similarly, these functions are not for initial model loading.

Concept tested. Azure Machine Learning model deployment, real-time inference web services, entry script structure, and the specific roles of the 'init()' and 'run()' functions in an Azure ML deployment script.

Topics

#Model Deployment#Real-time Inference#Entry Script#Azure ML Web Services

Community Discussion

No community discussion yet for this question.

Full DP-100 PracticeBrowse All DP-100 Questions