nerdexam
Microsoft

DP-100 · Question #172

Drag and Drop Question You plan to explore demographic data for home ownership in various cities. The data is in a CSV file with the following format: age,city,income,home_owner 21,Chicago,50000,0 35,

The correct answer is log; log_image; log_table. The question tests the ability to correctly apply Azure ML Run object logging methods for different data types: scalar values, plots, and structured dictionaries.

Explore data and run experiments

Question

Drag and Drop Question You plan to explore demographic data for home ownership in various cities. The data is in a CSV file with the following format: age,city,income,home_owner 21,Chicago,50000,0 35,Seattle,120000,1 23,Seattle,65000,0 45,Seattle,130000,1 18,Chicago,48000,0 You need to run an experiment in your Azure Machine Learning workspace to explore the data and log the results. The experiment must log the following information: - the number of observations in the dataset - a box plot of income by home_owner - a dictionary containing the city names and the average income for each city You need to use the appropriate logging methods of the experiment's run object to log the required information. How should you complete the code? To answer, drag the appropriate code segments to the correct locations. Each code segment 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:

Exhibit

DP-100 question #172 exhibit

Answer Area

Drag items

loglog_listlog_rowlog_tablelog_image

Correct arrangement

  • log
  • log_image
  • log_table

Explanation

The question tests the ability to correctly apply Azure ML Run object logging methods for different data types: scalar values, plots, and structured dictionaries.

Approach. The core task is to log three distinct types of information using the appropriate methods of the run object in Azure Machine Learning:

  1. Logging the number of observations (a single numerical value): The code calculates row_count = len(data). To log a single key-value metric, the run.log() method is used. The blank for this requirement is run. Segment ("observations", row_count). Therefore, 'log' should be dragged here.
  2. Logging a box plot (a Matplotlib figure): The code generates a Matplotlib figure named fig. To log an image or a plot, the run.log_image() method is specifically designed for this purpose. The blank for this requirement is run. Segment (name = "income_by_home_owner", plot = fig). Therefore, 'log_image' should be dragged here.
  3. Logging a dictionary of city names and average income: The code creates mean_inc_dict, which is a dictionary mapping city names to average incomes. To log structured data like a dictionary or tabular data, the run.log_table() method is the most appropriate. It can interpret a dictionary as key-value pairs suitable for a table. The blank for this requirement is run. Segment (name = "mean_income_by_city", value = mean_inc_dict). Therefore, 'log_table' should be dragged here.

Common mistakes.

  • common_mistake. Common mistakes arise from misunderstanding the purpose of each logging method:
  • Using 'log_list': log_list is used to log a list of numeric values or strings under a single metric name. It's not suitable for a single scalar value, a plot, or a key-value dictionary that represents structured data.
  • Using 'log_row': log_row is used to log a single row of a table. While a dictionary could be interpreted as a row, log_table is generally more versatile and idiomatic for logging a complete dictionary where keys often represent columns or distinct items.
  • Using 'log' for a plot or dictionary: The log method is strictly for logging single key-value metrics (scalars). It cannot handle Matplotlib figure objects or complex dictionary structures directly for visualization or structured storage.
  • Interchanging 'log_table' with 'log_list' or 'log_row' for the dictionary: The mean_inc_dict is structured data, and log_table is the most appropriate for representing such data in a structured, queryable format within the experiment run.

Concept tested. Azure Machine Learning experiment tracking and logging, specifically using the azureml.core.Run object's methods to log different data types (scalars, images/plots, and structured data like dictionaries) to track experiment metrics and artifacts.

Topics

#Azure ML Experiments#Logging#Run Object#Data Exploration

Community Discussion

No community discussion yet for this question.

Full DP-100 Practice