exam questions

Exam DP-100 All Questions

View all questions & answers for the DP-100 exam

Exam DP-100 topic 3 question 57 discussion

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

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 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 from a file, identifies the set of unique values for the label column, and completes the experiment run:

The experiment must record the unique labels in the data as metrics for the run that can be reviewed later.
You must add code to the script to record the unique label values as run metrics at the point indicated by the comment.
Solution: Replace the comment with the following code:
for label_val in label_vals:
run.log('Label Values', label_val)
Does the solution meet the goal?

  • A. Yes
  • B. No
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
giusecozza
Highly Voted 2 years, 5 months ago
answer A is correct, no doubt. "Logging a metric to a run causes that metric to be stored in the run record in the experiment. You can log the same metric multiple times within a run, the result being considered a vector of that metric. If step is specified for a metric it must be specified for all values." https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.run(class)?view=azure-ml-py#azureml-core-run-log
upvoted 10 times
...
ranjsi01
Highly Voted 3 years ago
why not run.log_list Log a list of values to the run with the given name using log_list. Example: run.log_list("accuracies", [0.6, 0.7, 0.87]) https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.run(class)?view=azure-ml-py
upvoted 9 times
...
KeiNek
Most Recent 2 days, 16 hours ago
Selected Answer: A
A. for label_val in label_vals: run.log('Label Values', label_val)
upvoted 1 times
...
testgm
2 months, 2 weeks ago
Selected Answer: A
correct answer is A
upvoted 1 times
...
Stemix
11 months ago
Selected Answer: A
Answer A is correct since we are looping all the elements of the array. So log is fine(and not log_list) because every time we are logging a scalar
upvoted 1 times
...
Karthikat
11 months, 2 weeks ago
answer A is correct, here performance is not consideration. It does the job
upvoted 1 times
...
deyoz
1 year ago
Selected Answer: A
Why A is not the correct. it logs all the values one at a time. For sure log_list is better solution, but for loop here also works in my opinion
upvoted 1 times
...
NullVoider_0
1 year, 1 month ago
Selected Answer: B
The best solution is to use the run.log_list method, which can log a list of values as a metric
upvoted 2 times
...
Hisayuki
1 year, 3 months ago
Selected Answer: B
unique() creates the array. So run.log_list should be used. ----- u = df['state'].unique() print(u) print(type(u)) # ['NY' nan 'CA' 'TX'] # <class 'numpy.ndarray'>
upvoted 1 times
...
colin1919
1 year, 3 months ago
Selected Answer: B
(1) Should be log_list() (2) Should be a list not np.array
upvoted 1 times
...
fhlos
1 year, 7 months ago
Selected Answer: A
YES - ChatGPT Yes, the solution meets the goal. The provided code snippet correctly loads the data from a CSV file, identifies the unique values in the label column, and logs each unique label value as a run metric using the run.log() function. Finally, the run.complete() function is called to indicate the completion of the experiment run. The unique label values will be recorded as run metrics and can be reviewed later.
upvoted 1 times
...
fhlos
1 year, 7 months ago
YES - ChatGPT Yes, the solution meets the goal. The provided code snippet correctly loads the data from a CSV file, identifies the unique values in the label column, and logs each unique label value as a run metric using the run.log() function. Finally, the run.complete() function is called to indicate the completion of the experiment run. The unique label values will be recorded as run metrics and can be reviewed later.
upvoted 1 times
...
RamundiGR
2 years ago
the answer is correct because we are looping on label_vals array
upvoted 5 times
...
michaelmorar
2 years, 2 months ago
Selected Answer: B
Correct (A) - run.log(‘Label Values’, label_val)
upvoted 1 times
casiopa
2 years, 2 months ago
Why not run.log_list() ? run.log_list('Label Values, label_val) or run.log_list('Label Values', list((label_val))
upvoted 1 times
...
michaelmorar
2 years, 2 months ago
SORRY! Accidentally clicked on B, but meant to vote for A
upvoted 1 times
...
...
zb99
2 years, 8 months ago
Selected Answer: A
Read the sample code carefully. It is actually a loop logging each value individually, not the list all at once.
upvoted 3 times
chevyli
2 years, 5 months ago
So the code will log the same metric named 'label values' multiple times. This seems not the expected result.
upvoted 1 times
...
...
racnaoamo
2 years, 8 months ago
similar question on 18-5-22
upvoted 1 times
...
JTWang
2 years, 10 months ago
label_vals is numpy.ndarray ==>run.log_list('Label Values', label_vals) Scalar Example: run.log("accuracy", 0.95) List Example: run.log_list("accuracies", [0.6, 0.7, 0.87]) Row Example: run.log_row("Y over X", x=1, y=0.4) Table Example: run.log_table("Y over X", {"x":[1, 2, 3], "y":[0.6, 0.7, 0.89]}) Image Example: run.log_image("ROC", path)
upvoted 2 times
Tj87
2 years, 9 months ago
agree. It's even mentioned here https://docs.microsoft.com/en-us/azure/machine-learning/how-to-log-view-metrics
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