DP-100 practice question 11 of 35
You plan to use a Python script to run an Azure Machine Learning experiment. The script creates a reference to the experiment run context, loads data…
Full set: 506 questionsDomain Run experiments and train models
The solution is incorrect because the code provided will fail. The run.logtable() method expects the second argument (value) to be a dictionary, where each key is a column name and the corresponding value is a list of the data for that column. The variable labelvals, created by data['label'].unique(), is a NumPy array, not a dictionary. Passing a NumPy array directly to run.logtable() results in a TypeError because the argument type is invalid. The code will not execute successfully and therefore will not log the required metrics.
A. Yes: This is incorrect because the provided code is syntactically wrong for the run.logtable method. The method's signature requires a dictionary for the value parameter, but a NumPy array is supplied, which will cause an error.
1. Microsoft Azure Machine Learning SDK Documentation: The official documentation for the azureml.core.Run class specifies the signature for the logtable method.
Source: Microsoft Docs
azureml.core.Run class.
Reference: The method signature is defined as logtable(name: str
value: dict
description: str = ''). This explicitly shows that the value parameter must be a dictionary (dict).
2. Pandas Library Documentation: The documentation for the pandas.unique function confirms the data type of the returned object.
Source: pandas development team
pandas 2.2.2 documentation.
Reference: The pandas.unique function "Return[s] unique values of Series object... The unique values are returned in order of appearance. Hash table-based unique
therefore does NOT sort. Returns: numpy.ndarray". This confirms labelvals is a NumPy array.
Link: https://pandas.pydata.org/docs/reference/api/pandas.unique.html
Keep practicing
Take the free DP-100 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DP-100 practice questions
- Question 2Note: This question is part of a series of questions that present the same scenario. Each…
- Question 5You have an Azure Machine Learning workspace. You plan to run a job to tram a model as an…
- Question 6You create a script that trains a convolutional neural network model over multiple epochs…
- Question 8You train and register an Azure Machine Learning model You plan to deploy the model to an…
- Question 14You use Azure Machine Learning to train a model based on a dataset named dataset1. You de…
- Question 18You use the designer to create a training pipeline for a classification model. The pipeli…
