Skip to content

Machine Learning Associate · Domain 4: Model Deployment and Monitoring · 13% of the exam

Task 4.3: Detect various drift types using Databricks Data profiling; Create a custom metric to support a given ML modeling need

Profiles on inference and time series tables, baseline and consecutive drift in the drift metrics table, the statistics computed for numeric and categorical columns, and aggregate, derived and drift custom metrics.

Study it

  • Drift and custom metrics with data profiling

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.

Question 1 · choose 1

A team creates a data profile of the inference profile type on the inference table of its churn model, with a timestamp column, a daily granularity and no baseline table. After two weeks of daily refreshes, the team looks for drift in the inputs. Which drift does data profiling compute for this profile?

  1. AConsecutive drift, which compares each daily window with the window of the day before
  2. BBaseline drift, which compares each daily window with the first day, used as the baseline
  3. CBoth drift types, with the model's training data used as the baseline automatically
  4. DNo drift at all, because drift is computed only against a baseline table that the profile specifies
Show the answer and why
  • AConsecutive drift, which compares each daily window with the window of the day before

    Correct

    Consecutive drift compares a window to the previous time window and is calculated whenever a consecutive window exists after aggregation.

  • BBaseline drift, which compares each daily window with the first day, used as the baseline

    Incorrect

    Baseline drift compares a window to the distribution of a baseline table and is only calculated if a baseline table is provided.

  • CBoth drift types, with the model's training data used as the baseline automatically

    Incorrect

    A baseline table is optional and has to be specified; without one, baseline drift is not calculated.

  • DNo drift at all, because drift is computed only against a baseline table that the profile specifies

    Incorrect

    Drift is also computed between successive time windows when a consecutive window exists, with or without a baseline table.

Data profiling computes two types of drift. Consecutive drift compares a time window with the previous one and is calculated only if a consecutive window exists after aggregation by the chosen granularities. Baseline drift compares a window with the distribution of a baseline table, which is optional and must be specified, and is calculated only if one is provided. A daily inference profile without a baseline table therefore gets consecutive drift from its second day on, and no baseline drift.

Question 2 · choose 1

A data profile of the Unity Catalog table ml.scoring.loans_log is created with output_schema_name set to ml.monitoring. Where do its drift statistics land?

  1. AIn the Delta table ml.monitoring.loans_log_drift_metrics
  2. BIn the Delta table ml.scoring.loans_log_drift_metrics
  3. CIn ml.monitoring.loans_log_profile_metrics, next to the summary statistics
  4. DIn new columns that the profile adds to ml.scoring.loans_log itself
Show the answer and why
  • AIn the Delta table ml.monitoring.loans_log_drift_metrics

    Correct

    Drift statistics are saved to {output_schema}.{table_name}_drift_metrics, a Delta table in the schema that output_schema_name names.

  • BIn the Delta table ml.scoring.loans_log_drift_metrics

    Incorrect

    The metric tables are saved in {output_schema}, the catalog and schema that output_schema_name specifies, here ml.monitoring, not in the schema of the profiled table.

  • CIn ml.monitoring.loans_log_profile_metrics, next to the summary statistics

    Incorrect

    The profile metrics table holds the summary statistics; drift has its own drift metrics table.

  • DIn new columns that the profile adds to ml.scoring.loans_log itself

    Incorrect

    The metric tables are separate Delta tables, stored in the Unity Catalog schema that you specify.

When a profile runs, it creates or updates two metric tables, saved as {output_schema}.{table_name}_profile_metrics, which holds the summary statistics, and {output_schema}.{table_name}_drift_metrics, which holds the drift statistics. They are Delta tables in the Unity Catalog schema given by output_schema_name, and a dashboard is created on top of them.

Question 3 · choose 1

A data scientist wants to profile a 9 TB feature table that has an event_date column, so that the team can watch its feature distributions over time. She first plans a snapshot profile. Which profile type does the data profiling documentation point to for a table of this size?

  1. AA snapshot profile, which processes only the rows that changed since the last refresh
  2. BA time series profile on the event_date column, as snapshot profiles support tables of up to 4 TB
  3. CAn inference profile, the type the documentation names for tables larger than 4 TB
  4. DA snapshot profile on a materialized view of the table, which profiles incrementally
Show the answer and why
  • AA snapshot profile, which processes only the rows that changed since the last refresh

    Incorrect

    A snapshot profile processes the complete table with every refresh, and its maximum table size is 4 TB.

  • BA time series profile on the event_date column, as snapshot profiles support tables of up to 4 TB

    Correct

    The maximum table size for a snapshot profile is 4 TB; for larger tables, the documentation says to use time series profiles.

  • CAn inference profile, the type the documentation names for tables larger than 4 TB

    Incorrect

    Inference profiles are for tables that hold a model's request log, with inputs and predictions; this is a feature table.

  • DA snapshot profile on a materialized view of the table, which profiles incrementally

    Incorrect

    Profiles created over materialized views do not support incremental processing.

Data profiling offers three profile types. A time series profile computes metrics across time-based windows of a table with a timestamp column; an inference profile does the same for a model's request log and adds model quality metrics; a snapshot profile processes the complete table with every refresh and supports tables of up to 4 TB, so larger tables use time series profiles instead. Profiles over materialized views do not support incremental processing.

Databricks documentation

Question 4 · choose 1

In the drift metrics table of a data profile, the population_stability_index of the column income is 0.27 for the latest window. How does the data profiling documentation read this value?

  1. ANo significant population change, because the index stays below 1
  2. BA moderate population change, because the index is between 0.1 and 0.5
  3. CA significant population change, because the index is 0.2 or more
  4. DThat 27% of the rows changed value since the comparison window
Show the answer and why
  • ANo significant population change, because the index stays below 1

    Incorrect

    The documentation calls a value below 0.1 no significant population change; 0.27 is far above that.

  • BA moderate population change, because the index is between 0.1 and 0.5

    Incorrect

    Moderate change is a value below 0.2; from 0.2 on, the change is significant.

  • CA significant population change, because the index is 0.2 or more

    Correct

    A population stability index of 0.2 or more indicates a significant population change.

  • DThat 27% of the rows changed value since the comparison window

    Incorrect

    The index is a numeric value in the range from 0 to infinity that says how different two distributions are, not a share of rows.

The population stability index in the drift metrics table is a numeric value, in the range from 0 to infinity, that represents how different two distributions are. The documentation reads it as follows: below 0.1 means no significant population change, below 0.2 a moderate population change, and 0.2 or more a significant population change.

Question 5 · choose 1

In a Unity Catalog workspace with access to Databricks SQL, a data scientist holds USE CATALOG on the catalog, USE SCHEMA on the schema and SELECT on the inference table of her model, but she cannot enable data profiling on that table. What else do the data profiling requirements call for?

  1. AMODIFY on the inference table
  2. BAn account that is enabled for serverless compute
  3. CPermission to attach to an all-purpose cluster for refreshes
  4. DMANAGE on the catalog, the schema or the table
Show the answer and why
  • AMODIFY on the inference table

    Incorrect

    MODIFY is not among the listed privileges, and the metric tables are separate Delta tables in a schema that you specify.

  • BAn account that is enabled for serverless compute

    Incorrect

    Data profiling uses serverless compute for jobs but does not require that the account be enabled for serverless compute.

  • CPermission to attach to an all-purpose cluster for refreshes

    Incorrect

    Profile refreshes run as jobs on serverless compute, so no all-purpose cluster is involved.

  • DMANAGE on the catalog, the schema or the table

    Correct

    Besides USE CATALOG, USE SCHEMA and SELECT, enabling data profiling requires MANAGE on the catalog, schema, or table.

Data profiling requires a workspace enabled for Unity Catalog and access to Databricks SQL. To enable it on a table you need USE CATALOG on the catalog and USE SCHEMA on the schema that contain the table, SELECT on the table, and MANAGE on the catalog, schema or table. Profiling uses serverless compute for its jobs, without requiring that the account be enabled for serverless compute, and writes its metrics to separate Delta tables in an output schema.

Databricks documentation

Practice domain 4 →Practice all domains →