DP-100 Data Science Questions Topic 3
You deploy a model as an Azure Machine Learning real-time web service using the following code. # ws, model, interference_config, and deployment_config defined previously service = Model.deploy(ws, 'classification-service', [model], inference_config, deployment_config) service.wait_for_deployment(True) The deployment fails. You need to troubleshoot the deployment failure by determining the actions that were performed during deployment and identifying the specific action that failed. Which code segment should you run? A. service.get_logs() B. service.state C. service.serialize() D. service.update_deployment_state()
Correct Answer: A You can print out detailed Docker engine log messages from the service object. You can view the log for ACI, AKS, and Local deployments. The following example demonstrates how to print the logs. # if you already have the service object handyprint(service.get_logs()) # if you only know the name of the service (note there might be multiple services with the same name but different version number) print(ws.webservices['mysvc'].get_logs()) Reference:https://docs.microsoft.com/en-us/azure/machine-learning/how-to-troubleshoot-deployment
You train a machine learning model. You must deploy the model as a real-time inference service for testing. The service requires low CPU utilization and less than 48 MB of RAM. The compute target for the deployed service must initialize automatically while minimizing cost and administrative overhead. Which compute target should you use? A. Azure Container Instance (ACI) B. attached Azure Databricks cluster C. Azure Kubernetes Service (AKS) inference cluster D. Azure Machine Learning compute cluster
Correct Answer: A Azure Container Instances (ACI) are suitable only for small models less than 1 GB in size. Use it for low-scale CPU-based workloads that require less than 48 GB of RAM. Note: Microsoft recommends using single-node Azure Kubernetes Service (AKS) clusters for dev-test of larger models. Reference: https://docs.microsoft.com/id-id/azure/machine-learning/how-to-deploy-and-where
You use the designer to create a training pipeline for a classification model. The pipeline uses a dataset that includes the features and labels required for model training. You create a real-time inference pipeline from the training pipeline. You observe that the schema for the generated web service input is based on the dataset and includes the label column that the model predicts. Client applications that use the service must not be required to submit this value. You need to modify the inference pipeline to meet the requirement. What should you do? A. Add a Select Columns in Dataset module to the inference pipeline after the dataset and use it to select all columns other than the label. B. Delete the dataset from the training pipeline and recreate the real-time inference pipeline. C. Delete the Web Service Input module from the inference pipeline. D. Replace the dataset in the inference pipeline with an Enter Data Manually module that includes data for the feature columns but not the label column.
Correct Answer: A By default, the Web Service Input will expect the same data schema as the module output data which connects to the same downstream port as it. You can remove the target variable column in the inference pipeline using Select Columns in Dataset module. Make sure that the output of Select Columns in Dataset removing target variable column is connected to the same port as the output of the Web Service Intput module. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-designer-automobile-price-deploy
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution. After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen. You train and register a machine learning model. You plan to deploy the model as a real-time web service. Applications must use key-based authentication to use the model. You need to deploy the web service. Solution: Create an AciWebservice instance. Set the value of the auth_enabled property to True. Deploy the model to the service. Does the solution meet the goal? A. Yes B. No
Correct Answer: A Key-based authentication. Web services deployed on AKS have key-based auth enabled by default. ACI-deployed services have key-based auth disabled by default, but you can enable it by setting auth_enabled = TRUE when creating the ACI web service. The following is an example of creating an ACI deployment configuration with key-based auth enabled. deployment_config <- aci_webservice_deployment_config(cpu_cores = 1, memory_gb = 1, auth_enabled = TRUE) Reference: https://azure.github.io/azureml-sdk-for-r/articles/deploying-models.html
You train and register a model in your Azure Machine Learning workspace. You must publish a pipeline that enables client applications to use the model for batch inferencing. You must use a pipeline with a single ParallelRunStep step that runs a Python inferencing script to get predictions from the input data. You need to create the inferencing script for the ParallelRunStep pipeline step. Which two functions should you include? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point. A. run(mini_batch) B. main() C. batch() D. init() E. score(mini_batch)
Correct Answer: AD Reference: https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/machine-learning-pipelines/parallel-run https://docs.microsoft.com/en-us/learn/modules/deploy-batch-inference-pipelines-with-azure-machine-learning/2-batch-inference-pipelines
HOTSPOT - You use Azure Machine Learning to train and register a model. You must deploy the model into production as a real-time web service to an inference cluster named service-compute that the IT department has created in the Azure Machine Learning workspace. Client applications consuming the deployed web service must be authenticated based on their Azure Active Directory service principal. You need to write a script that uses the Azure Machine Learning SDK to deploy the model. The necessary modules have been imported. How should you complete the code? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. Hot Area: # Assume the necessary modules have been imported deploy_target = >>1<<.(ws, "service-compute") deployment_config = >>2<<.deploy_configuration(cpu_cores=1, memory_gb=1, >>3<<) service = Model.deploy(ws, "ml-service", [model], inference_config, deployment_config, deploy_target) service.wait_for_deployment(show_output = True) >>1<<: AksCompute; AmlCompute; RemoteCompute, BatchCompute >>2<<: AksWebservice; AciWebservice; LocalWebService >>3<<: token_auth_enabled=True; token_auth_enabled=False; auth_enabled=True; auth_enabled=False
Correct Answer: AksCompute; AksWebservice; token_auth_enabled=True Box 1: AksCompute - Example:aks_target = AksCompute(ws,"myaks") # If deploying to a cluster configured for dev/test, ensure that it was created with enough # cores and memory to handle this deployment configuration. Note that memory is also used by # things such as dependencies and AML components. deployment_config = AksWebservice.deploy_configuration(cpu_cores = 1, memory_gb = 1) service = Model.deploy(ws, "myservice", [model], inference_config, deployment_config, aks_target) Box 2: AksWebservice - Box 3: token_auth_enabled=Yes - Whether or not token auth is enabled for the Webservice. Note: A Service principal defined in Azure Active Directory (Azure AD) can act as a principal on which authentication and authorization policies can be enforced inAzure Databricks. The Azure Active Directory Authentication Library (ADAL) can be used to programmatically get an Azure AD access token for a user. Incorrect Answers: auth_enabled (bool): Whether or not to enable key auth for this Webservice. Defaults to True. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-deploy-azure-kubernetes-service https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token
You register a model that you plan to use in a batch inference pipeline. The batch inference pipeline must use a ParallelRunStep step to process files in a file dataset. The script has the ParallelRunStep step runs must process six input files each time the inferencing function is called. You need to configure the pipeline. Which configuration setting should you specify in the ParallelRunConfig object for the PrallelRunStep step? A. process_count_per_node= "6" B. node_count= "6" C. mini_batch_size= "6" D. error_threshold= "6"
Correct Answer: B Alternative Answer: C YES (all responses) (Question notes that the type of dateset to be used is a file dataset. Microsoft documentation says mini_batch_size: For FileDataset input, this field is the number of files a user script can process in one run() call https://docs.microsoft.com/en-us/python/api/azureml-pipeline-steps/azureml.pipeline.steps.parallel_run_config.parallelrunconfig?view=azure-ml-py) node_count is the number of nodes in the compute target used for running the ParallelRunStep. Incorrect Answers: A: process_count_per_node - Number of processes executed on each node. (optional, default value is number of cores on node.) C: mini_batch_size - For FileDataset input, this field is the number of files user script can process in one run() call. For TabularDataset input, this field is the approximate size of data the user script can process in one run() call. Example values are 1024, 1024KB, 10MB, and 1GB. D: error_threshold - The number of record failures for TabularDataset and file failures for FileDataset that should be ignored during processing. If the error count goes above this value, then the job will be aborted. Reference: https://docs.microsoft.com/en-us/python/api/azureml-contrib-pipeline-steps/azureml.contrib.pipeline.steps.parallelrunconfig?view=azure-ml-py
You train a model and register it in your Azure Machine Learning workspace. You are ready to deploy the model as a real-time web service. You deploy the model to an Azure Kubernetes Service (AKS) inference cluster, but the deployment fails because an error occurs when the service runs the entry script that is associated with the model deployment. You need to debug the error by iteratively modifying the code and reloading the service, without requiring a re-deployment of the service for each code update. What should you do? A. Modify the AKS service deployment configuration to enable application insights and re-deploy to AKS. B. Create an Azure Container Instances (ACI) web service deployment configuration and deploy the model on ACI. C. Add a breakpoint to the first line of the entry script and redeploy the service to AKS. D. Create a local web service deployment configuration and deploy the model to a local Docker container. E. Register a new version of the model and update the entry script to load the new version of the model from its registered path.
Correct Answer: B Alternative Answer: D YES (If you encounter problems deploying a model to ACI or AKS, try deploying it as a local web service. Using a local web service makes it easier to troubleshoot problems. The Docker image containing the model is downloaded and started on your local system. ACI is for production of low resource models. 1GB size and 48 GB ram or less https://docs.microsoft.com/en-us/azure/machine-learning/how-to-troubleshoot-deployment) How to work around or solve common Docker deployment errors with Azure Container Instances (ACI) and Azure Kubernetes Service (AKS) using Azure MachineLearning. The recommended and the most up to date approach for model deployment is via the Model.deploy() API using an Environment object as an input parameter. In this case our service will create a base docker image for you during deployment stage and mount the required models all in one call. The basic deployment tasks are: 1. Register the model in the workspace model registry. 2. Define Inference Configuration: a) Create an Environment object based on the dependencies you specify in the environment yaml file or use one of our procured environments. b) Create an inference configuration (InferenceConfig object) based on the environment and the scoring script. 3. Deploy the model to Azure Container Instance (ACI) service or to Azure Kubernetes Service (AKS).
You use Azure Machine Learning designer to create a real-time service endpoint. You have a single Azure Machine Learning service compute resource. You train the model and prepare the real-time pipeline for deployment. You need to publish the inference pipeline as a web service. Which compute type should you use? A. a new Machine Learning Compute resource B. Azure Kubernetes Services C. HDInsight D. the existing Machine Learning Compute resource E. Azure Databricks
Correct Answer: B Azure Kubernetes Service (AKS) can be used for real-time inference. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/concept-compute-target
You deploy a real-time inference service for a trained model. The deployed model supports a business-critical application, and it is important to be able to monitor the data submitted to the web service and the predictions the data generates. You need to implement a monitoring solution for the deployed model using minimal administrative effort. What should you do? A. View the explanations for the registered model in Azure ML studio. B. Enable Azure Application Insights for the service endpoint and view logged data in the Azure portal. C. View the log files generated by the experiment used to train the model. D. Create an ML Flow tracking URI that references the endpoint, and view the data logged by ML Flow.
Correct Answer: B Configure logging with Azure Machine Learning studio You can also enable Azure Application Insights from Azure Machine Learning studio. When you're ready to deploy your model as a web service, use the following steps to enable Application Insights: 1. Sign in to the studio at https://ml.azure.com. 2. Go to Models and select the model you want to deploy. 3. Select +Deploy. 4. Populate the Deploy model form.5. Expand the Advanced menu. 6. Select Enable Application Insights diagnostics and data collection. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-enable-app-insights
You create an Azure Machine Learning workspace named ML-workspace. You also create an Azure Databricks workspace named DB-workspace. DB-workspace contains a cluster named DB-cluster. You must use DB-cluster to run experiments from notebooks that you import into DB-workspace. You need to use ML-workspace to track MLflow metrics and artifacts generated by experiments running on DB-cluster. The solution must minimize the need for custom code. What should you do? A. From DB-cluster, configure the Advanced Logging option. B. From DB-workspace, configure the Link Azure ML workspace option. C. From ML-workspace, create an attached compute. D. From ML-workspace, create a compute cluster.
Correct Answer: B Connect your Azure Databricks and Azure Machine Learning workspaces: Linking your ADB workspace to your Azure Machine Learning workspace enables you to track your experiment data in the Azure Machine Learning workspace. To link your ADB workspace to a new or existing Azure Machine Learning workspace 1. Sign in to Azure portal. 2. Navigate to your ADB workspace's Overview page. 3. Select the Link Azure Machine Learning workspace button on the bottom right.
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution. After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen. You train and register a machine learning model. You plan to deploy the model as a real-time web service. Applications must use key-based authentication to use the model. You need to deploy the web service. Solution: Create an AciWebservice instance. Set the value of the auth_enabled property to False. Set the value of the token_auth_enabled property to True. Deploy the model to the service. Does the solution meet the goal? A. Yes B. No
Correct Answer: B Instead use only auth_enabled = TRUE Note: Key-based authentication. Web services deployed on AKS have key-based auth enabled by default. ACI-deployed services have key-based auth disabled by default, but you can enable it by setting auth_enabled = TRUE when creating the ACI web service. The following is an example of creating an ACI deployment configuration with key-based auth enabled. deployment_config <- aci_webservice_deployment_config(cpu_cores = 1, memory_gb = 1, auth_enabled = TRUE) Reference: https://azure.github.io/azureml-sdk-for-r/articles/deploying-models.html
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution. After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen. You train and register a machine learning model. You plan to deploy the model as a real-time web service. Applications must use key-based authentication to use the model. You need to deploy the web service. Solution: Create an AciWebservice instance. Set the value of the ssl_enabled property to True. Deploy the model to the service. Does the solution meet the goal? A. Yes B. No
Correct Answer: B Instead use only auth_enabled = TRUE Note: Key-based authentication.Web services deployed on AKS have key-based auth enabled by default. ACI-deployed services have key-based auth disabled by default, but you can enable it by setting auth_enabled = TRUE when creating the ACI web service. The following is an example of creating an ACI deployment configuration with key-based auth enabled. deployment_config <- aci_webservice_deployment_config(cpu_cores = 1, memory_gb = 1, auth_enabled = TRUE) Reference: https://azure.github.io/azureml-sdk-for-r/articles/deploying-models.html
You retrain an existing model. You need to register the new version of a model while keeping the current version of the model in the registry. What should you do? A. Register a model with a different name from the existing model and a custom property named version with the value 2. B. Register the model with the same name as the existing model. C. Save the new model in the default datastore with the same name as the existing model. Do not register the new model. D. Delete the existing model and register the new one with the same name.
Correct Answer: B Model version: A version of a registered model. When a new model is added to the Model Registry, it is added as Version 1. Each model registered to the same model name increments the version number. Reference:https://docs.microsoft.com/en-us/azure/databricks/applications/mlflow/model-registry
An organization creates and deploys a multi-class image classification deep learning model that uses a set of labeled photographs. The software engineering team reports there is a heavy inferencing load for the prediction web services during the summer. The production web service for the model fails to meet demand despite having a fully-utilized compute cluster where the web service is deployed. You need to improve performance of the image classification web service with minimal downtime and minimal administrative effort. What should you advise the IT Operations team to do? A. Create a new compute cluster by using larger VM sizes for the nodes, redeploy the web service to that cluster, and update the DNS registration for the service endpoint to point to the new cluster. B. Increase the node count of the compute cluster where the web service is deployed. C. Increase the minimum node count of the compute cluster where the web service is deployed. D. Increase the VM size of nodes in the compute cluster where the web service is deployed.
Correct Answer: B The Azure Machine Learning SDK does not provide support scaling an AKS cluster. To scale the nodes in the cluster, use the UI for your AKS cluster in the AzureMachine Learning studio. You can only change the node count, not the VM size of the cluster. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-create-attach-kubernetes
You use the following Python code in a notebook to deploy a model as a web service: from azureml.core.webservice import AciWebservice from azureml.core.model import InferenceConfig inference_config = InferenceConfig(runtime='python', source_directory='model_files', entry_script='score.py', conda_file='env.yml') deployment_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1) service = Model.deploy(ws, 'my-service', [model], inference_config, deployment_config) service.wait_for_deployment(True) The deployment fails. You need to use the Python SDK in the notebook to determine the events that occurred during service deployment an initialization. Which code segment should you use? A. service.state B. service.get_logs() C. service.serialize() D. service.environment
Correct Answer: B The first step in debugging errors is to get your deployment logs. In Python: service.get_logs() Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-troubleshoot-deployment
You create a deep learning model for image recognition on Azure Machine Learning service using GPU-based training. You must deploy the model to a context that allows for real-time GPU-based inferencing. You need to configure compute resources for model inferencing. Which compute type should you use? A. Azure Container Instance B. Azure Kubernetes Service C. Field Programmable Gate Array D. Machine Learning Compute
Correct Answer: B You can use Azure Machine Learning to deploy a GPU-enabled model as a web service. Deploying a model on Azure Kubernetes Service (AKS) is one option. The AKS cluster provides a GPU resource that is used by the model for inference. Inference, or model scoring, is the phase where the deployed model is used to make predictions. Using GPUs instead of CPUs offers performance advantages on highly parallelizable computation. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-deploy-inferencing-gpus
You have a Python script that executes a pipeline. The script includes the following code: from azureml.core import Experiment pipeline_run = Experiment(ws, 'pipeline_test').submit(pipeline) You want to test the pipeline before deploying the script. You need to display the pipeline run details written to the STDOUT output when the pipeline completes. Which code segment should you add to the test script? A. pipeline_run.get.metrics() B. pipeline_run.wait_for_completion(show_output=True) C. pipeline_param = PipelineParameter(name="stdout", default_value="console") D. pipeline_run.get_status()
Correct Answer: B wait_for_completion: Wait for the completion of this run. Returns the status object after the wait. Syntax: wait_for_completion(show_output=False, wait_post_processing=False, raise_on_error=True) Parameter: show_output - Indicates whether to show the run output on sys.stdout.
You use the Azure Machine Learning Python SDK to define a pipeline that consists of multiple steps. When you run the pipeline, you observe that some steps do not run. The cached output from a previous run is used instead. You need to ensure that every step in the pipeline is run, even if the parameters and contents of the source directory have not changed since the previous run. What are two possible ways to achieve this goal? Each correct answer presents a complete solution. NOTE: Each correct selection is worth one point. A. Use a PipelineData object that references a datastore other than the default datastore. B. Set the regenerate_outputs property of the pipeline to True. C. Set the allow_reuse property of each step in the pipeline to False. D. Restart the compute cluster where the pipeline experiment is configured to run. E. Set the outputs property of each step in the pipeline to True.
Correct Answer: BC B: If regenerate_outputs is set to True, a new submit will always force generation of all step outputs, and disallow data reuse for any step of this run. Once this run is complete, however, subsequent runs may reuse the results of this run. C: Keep the following in mind when working with pipeline steps, input/output data, and step reuse. ✑ If data used in a step is in a datastore and allow_reuse is True, then changes to the data change won't be detected. If the data is uploaded as part of the snapshot (under the step's source_directory), though this is not recommended, then the hash will change and will trigger a rerun. Reference: https://docs.microsoft.com/en-us/python/api/azureml-pipeline-core/azureml.pipeline.core.pipelinestep https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-getting- started.ipynb
You use Azure Machine Learning designer to create a training pipeline for a regression model. You need to prepare the pipeline for deployment as an endpoint that generates predictions asynchronously for a dataset of input data values. What should you do? A. Clone the training pipeline. B. Create a batch inference pipeline from the training pipeline. C. Create a real-time inference pipeline from the training pipeline. D. Replace the dataset in the training pipeline with an Enter Data Manually module.
Correct Answer: C Alternative Answer: B YES (all responses) (DanielGP 1 year, 3 months ago "Asynchronously" is the key to this question. Correct answer must be "B". upvoted 11 times prashantjoge 10 months, 3 weeks ago no the catch phrase is "for a dataset of input values" If it was just asynchronous, real-time inference would be the correct answer. Tricky question) You must first convert the training pipeline into a real-time inference pipeline. This process removes training modules and adds web service inputs and outputs to handle requests. Incorrect Answers: A: Use the Enter Data Manually module to create a small dataset by typing values. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-designer-automobile-price-deploy https://docs.microsoft.com/en-us/azure/machine-learning/algorithm-module-reference/enter-data-manually
You are a data scientist working for a hotel booking website company. You use the Azure Machine Learning service to train a model that identifies fraudulent transactions. You must deploy the model as an Azure Machine Learning real-time web service using the Model.deploy method in the Azure Machine Learning SDK. The deployed web service must return real-time predictions of fraud based on transaction data input. You need to create the script that is specified as the entry_script parameter for the InferenceConfig class used to deploy the model. What should the entry script do? A. Register the model with appropriate tags and properties. B. Create a Conda environment for the web service compute and install the necessary Python packages. C. Load the model and use it to predict labels from input data. D. Start a node on the inference cluster where the web service is deployed. E. Specify the number of cores and the amount of memory required for the inference compute.
Correct Answer: C The entry script receives data submitted to a deployed web service and passes it to the model. It then takes the response returned by the model and returns that to the client. The script is specific to your model. It must understand the data that the model expects and returns. The two things you need to accomplish in your entry script are: ✑ Loading your model (using a function called init()) ✑ Running your model on input data (using a function called run()) Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-deploy-and-where
You use the Azure Machine Learning SDK to run a training experiment that trains a classification model and calculates its accuracy metric. The model will be retrained each month as new data is available. You must register the model for use in a batch inference pipeline. You need to register the model and ensure that the models created by subsequent retraining experiments are registered only if their accuracy is higher than the currently registered model. What are two possible ways to achieve this goal? Each correct answer presents a complete solution. NOTE: Each correct selection is worth one point. A. Specify a different name for the model each time you register it. B. Register the model with the same name each time regardless of accuracy, and always use the latest version of the model in the batch inferencing pipeline. C. Specify the model framework version when registering the model, and only register subsequent models if this value is higher. D. Specify a property named accuracy with the accuracy metric as a value when registering the model, and only register subsequent models if their accuracy is higher than the accuracy property value of the currently registered model. E. Specify a tag named accuracy with the accuracy metric as a value when registering the model, and only register subsequent models if their accuracy is higher than the accuracy tag value of the currently registered model.
Correct Answer: CE Alternative Answer: DE YES (are the only ones which take into account the accuracy value hence the correct answers.) E: Using tags, you can track useful information such as the name and version of the machine learning library used to train the model. Note that tags must be alphanumeric. Reference: https://notebooks.azure.com/xavierheriat/projects/azureml-getting-started/html/how-to-use-azureml/deployment/register-model-create-image-deploy-service/ register-model-create-image-deploy-service.ipynb
You are planning to register a trained model in an Azure Machine Learning workspace. You must store additional metadata about the model in a key-value format. You must be able to add new metadata and modify or delete metadata after creation. You need to register the model. Which parameter should you use? A. description B. model_framework C. tags D. properties
Correct Answer: D Alternate Answer: C YES (Tags can be deleted or changed. https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources?tabs=json) azureml.core.Model.properties: Dictionary of key value properties for the Model. These properties cannot be changed after registration, however new key value pairs can be added. Reference: https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.model.model
You develop and train a machine learning model to predict fraudulent transactions for a hotel booking website. Traffic to the site varies considerably. The site experiences heavy traffic on Monday and Friday and much lower traffic on other days. Holidays are also high web traffic days. You need to deploy the model as an Azure Machine Learning real-time web service endpoint on compute that can dynamically scale up and down to support demand. Which deployment compute option should you use? A. attached Azure Databricks cluster B. Azure Container Instance (ACI) C. Azure Kubernetes Service (AKS) inference cluster D. Azure Machine Learning Compute Instance E. attached virtual machine in a different region
Correct Answer: D Alternate Answer: C YES (all responses) (the answer is 'C' : Use for high-scale production deployments. Provides fast response time and autoscaling of the deployed service. https://docs.microsoft.com/fr-fr/azure/machine-learning/how-to-deploy-and-where?tabs=azcli) Azure Machine Learning compute cluster is a managed-compute infrastructure that allows you to easily create a single or multi-node compute. The compute is created within your workspace region as a resource that can be shared with other users in your workspace. The compute scales up automatically when a job is submitted, and can be put in an Azure Virtual Network. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-create-attach-compute-sdk
You use the Azure Machine Learning designer to create and run a training pipeline. You then create a real-time inference pipeline. You must deploy the real-time inference pipeline as a web service. What must you do before you deploy the real-time inference pipeline? A. Run the real-time inference pipeline. B. Create a batch inference pipeline. C. Clone the training pipeline. D. Create an Azure Machine Learning compute cluster.
Correct Answer: D Alternative Answer: A NO (Answer is A. Run the real-time inference pipeline. Related words: "Submit the inference pipeline as a new experiment named mslearn-designer-predict-diabetes on the compute cluster you used for training. This may take a while!" REF: https://microsoftlearning.github.io/mslearn-dp100/instructions/03-azureml-designer.html) You need to create an inferencing cluster. Deploy the real-time endpoint -After your AKS service has finished provisioning, return to the real-time inferencing pipeline to complete deployment. 1. Select Deploy above the canvas. 2. Select Deploy new real-time endpoint. 3. Select the AKS cluster you created. 4. Select Deploy. Reference: https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-designer-automobile-price-deploy
You create a multi-class image classification deep learning model. You train the model by using PyTorch version 1.2. You need to ensure that the correct version of PyTorch can be identified for the inferencing environment when the model is deployed. What should you do? A. Save the model locally as a.pt file, and deploy the model as a local web service. B. Deploy the model on computer that is configured to use the default Azure Machine Learning conda environment. C. Register the model with a .pt file extension and the default version property. D. Register the model, specifying the model_framework and model_framework_version properties.
Correct Answer: D framework_version: The PyTorch version to be used for executing training code. Reference: https://docs.microsoft.com/en-us/python/api/azureml-train-core/azureml.train.dnn.pytorch?view=azure-ml-py
You create a batch inference pipeline by using the Azure ML SDK. You run the pipeline by using the following code: from azureml.pipeline.core import Pipeline from azureml.core.experiment import Experiment pipeline = Pipeline(workspace=ws, steps=[parallelrun_step]) pipeline_run = Experiment(ws, 'batch_pipeline').submit(pipeline) You need to monitor the progress of the pipeline execution. What are two possible ways to achieve this goal? Each correct answer presents a complete solution. NOTE: Each correct selection is worth one point. A. Run the following code in a notebook: from azureml.contrib.interpret.explanation.explanation_client import ExplanationClient.from_run(pipeline_run) client = ExplanationClient.from_run(pipeline_run) explanation = client.download_model_explanation() explanation = client.download_model_explanation(top_k=4) global_importance_values = explanation.get_ranked_global_values() global_importance_names = explanation.get_ranked_blobal_names() print('global importance values: {}'.format(global_importance_values)) print('global importance names: {}'.format(global_importance_names)) B. Use the Inference Clusters tab in Machine Learning Studio. C. Use the Activity log in the Azure portal for the Machine Learning workspace. D. Run the following code in a notebook: from azureml.widgets import RunDetails RunDetails(pipeline_run).show() E. Run the following code and monitor the console output from the PipelineRun object: pipeline_run.wait_for_completion(show_output=True)
Correct Answer: DE A batch inference job can take a long time to finish. This example monitors progress by using a Jupyter widget. You can also manage the job's progress by using: ✑ Azure Machine Learning Studio. ✑ Console output from the PipelineRun object. from azureml.widgets import RunDetails RunDetails(pipeline_run).show() pipeline_run.wait_for_completion(show_output=True) Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-use-parallel-run-step#monitor-the-parallel-run-job
HOTSPOT - You create an Azure Machine Learning workspace. You need to detect data drift between a baseline dataset and a subsequent target dataset by using the DataDriftDetector class. How should you complete the code segment? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. Hot Area: from azureml.core import Workspace, Dataset from datetime import datetime ws = Workspace.from_config() dset = Dataset.get_by_name(ws, 'target') baseline = target.time_before(datetime(2021,2,1)) features = ['windAngle', 'windSpeed', 'temperature', 'stationName'] monitor = DataDriftDetector.>>1<< (ws, 'drift-monitor', baseline, target, compute_target='cpu-cluster', frequency='Week', feature_list=None, drift_threshold=.6, latency=24) monitor = DataDriftDetector.get_by_name(ws, 'drift-monitor') monitor = monitor.update(feature_list=features) complete = monitor.>>2<< (datetime(2021, 1, 1), datetime.today()) >>1<<: backfill, create_from_datasets, create_from_model >>2<<: backfill, list, update
Correct Answer: create_from_datasets, backfill Box 1: create_from_datasets - The create_from_datasets method creates a new DataDriftDetector object from a baseline tabular dataset and a target time series dataset. Box 2: backfill -The backfill method runs a backfill job over a given specified start and end date. Syntax: backfill(start_date, end_date, compute_target=None, create_compute_target=False) Incorrect Answers: List and update do not have datetime parameters. Reference: https://docs.microsoft.com/en-us/python/api/azureml-datadrift/azureml.datadrift.datadriftdetector(class)
HOTSPOT - You are a lead data scientist for a project that tracks the health and migration of birds. You create a multi-image classification deep learning model that uses a set of labeled bird photos collected by experts. You plan to use the model to develop a cross-platform mobile app that predicts the species of bird captured by app users. You must test and deploy the trained model as a web service. The deployed model must meet the following requirements: ✑ An authenticated connection must not be required for testing. ✑ The deployed model must perform with low latency during inferencing. ✑ The REST endpoints must be scalable and should have a capacity to handle large number of requests when multiple end users are using the mobile application. You need to verify that the web service returns predictions in the expected JSON format when a valid REST request is submitted. Which compute resources should you use? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. Hot Area: Test: - ds-workstation notebook VM - aks_compute cluster - cpu-compute cluster - gpu-compute cluster Production: - ds-workstation notebook VM - aks-compute cluster - cpu-compute cluster - gpu-compute cluster
Correct Answer: ds-workstation notebook VM; gpu-compute cluster Box 1: ds-workstation notebook VM An authenticated connection must not be required for testing. On a Microsoft Azure virtual machine (VM), including a Data Science Virtual Machine (DSVM), you create local user accounts while provisioning the VM. Users then authenticate to the VM by using these credentials. Box 2: gpu-compute cluster - Image classification is well suited for GPU compute clusters Reference: https://docs.microsoft.com/en-us/azure/machine-learning/data-science-virtual-machine/dsvm-common-identity https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/ai/training-deep-learning https://docs.microsoft.com/en-gb/azure/machine-learning/concept-compute-target https://docs.microsoft.com/en-gb/azure/machine-learning/how-to-deploy-local-container-notebook-vm
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: from azureml.core import Workspace >>1<< import json ws = Workspace.from_config() service_name = "mlmodel1-service" service = Webservice(name=service_name, workspace=ws) x_new = [[2, 101,.5, 1, 24, 21], [1, 89.7, 4, 41, 21]] input_json = json.dumps({"data": x_new}) >>2<< >>1<< - from azureml.core.web.service import requests - from azureml.core.web.service import Webservice - from azureml.core.web.service import LocalWebservice >>2<< - predictions = service.run(input_json) - predictions = requests.post(service.scoring_uri, input_json) - predictions = service.deserialize(ws, input_json)
Correct Answer: from azureml.core.webservice import Webservice; predictions = service.run(input_json) 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 https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.webservice(class)?view=azure-ml-py https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/deployment/deploy-to-cloud/model-register-and-deploy.ipynb
DRAG DROP - 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. Select and Place: Functions: main(); score(); run(); init(); predict() Actions: - Load the model when the service starts: ____ - Use the model to score new data: ____
Correct Answer: init(); run() Box 1: init() The entry script has only two required functions, init() and run(data). These functions are used to initialize the service at startup and run the model using request data passed in by a client. The rest of the script handles loading and running the model(s). Box 2: run() Reference: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-deploy-existing-model