Machine Learning Associate · 17% of the exam

Feature Engineering: free practice questions

5 sample questions from our 43-question bank for this domain — answers and explanations included. These are the same scenario-based style as the real Databricks exam.

1. A data scientist fits a LASSO regression model (L1 regularization) for feature selection on a dataset with 200 features. After tuning the regularization strength `alpha`, they observe that 170 features have coefficients exactly equal to zero. Which of the following CORRECTLY describes WHY L1 regularization produces sparse solutions, and what the 30 remaining non-zero features represent? (Select TWO)

  • A. L1 regularization adds the sum of absolute values of coefficients to the loss, which creates a geometry that encourages solutions at corners of the constraint space where many coefficients are exactly zero.✓ Correct
  • B. L1 regularization penalizes the sum of squared coefficients, which shrinks all coefficients proportionally toward zero but never sets them exactly to zero.
  • C. The 30 non-zero features are those the model has identified as having the strongest linear relationship with the target, given the chosen regularization strength.
  • D. L1 regularization performs automatic feature selection because its non-differentiable penalty at zero creates subgradients that pull small coefficients to exactly zero during optimization.✓ Correct
  • E. Increasing `alpha` further would increase the number of non-zero features because a higher penalty forces the model to distribute weight more evenly.
Explanation

Option A is correct: the L1 constraint region is a hyperdiamond (L1 ball) with corners aligned to the axes. The loss function's minimum tends to land on a corner where many coordinates are zero, producing sparsity — this is the geometric intuition for why L1 yields exact zeros. Option D is correct: analytically, the subdifferential of |w| at w=0 includes the interval [-1, 1], and the optimization update can push small coefficients precisely to zero during coordinate descent or subgradient methods. Together, these two options explain the mechanism from both geometric and optimization perspectives. Option B is incorrect: it describes L2 (Ridge) regularization, which penalizes squared coefficients and shrinks them toward zero but rarely to exactly zero. Option C is partially true in spirit but is imprecise — LASSO selects features based on the interplay between the penalty and the data; 'strongest linear relationship' is an oversimplification that ignores multicollinearity effects and does not describe the mechanism. Option E is incorrect: *increasing* `alpha` makes the penalty stronger, forcing *more* coefficients to zero (sparser solution), not fewer.

2. A data engineering team wants to build a production feature engineering pipeline on Databricks that (1) automatically tracks data lineage, (2) supports declarative pipeline definitions, (3) incrementally processes new data as it arrives in a Delta table source, and (4) materializes results as Delta tables. Which THREE capabilities of Delta Live Tables (DLT) directly support these requirements? (Select THREE)

  • A. Automatic data lineage tracking through the DLT graph✓ Correct
  • B. Declarative table definitions using @dlt.table decorators in Python or SQL✓ Correct
  • C. Incremental processing via STREAMING LIVE TABLE or stream='true' on Delta sources✓ Correct
  • D. Built-in hyperparameter tuning via Hyperopt integration
  • E. Native SMOTE implementation for handling class imbalance in DLT pipelines
  • F. Materialization of results as managed Delta tables with automatic schema enforcement
Explanation

Delta Live Tables natively supports all three selected capabilities: (1) Automatic lineage tracking — DLT builds a dependency graph of all tables and views, making lineage queryable through the DLT UI and Unity Catalog. (2) Declarative definitions — users define pipelines using @dlt.table Python decorators or LIVE TABLE SQL syntax, expressing *what* the output should be rather than *how* to compute it. (3) Incremental processing — STREAMING LIVE TABLE reads Delta sources as streams, processing only new records using structured streaming semantics. Built-in Hyperopt integration is not a DLT feature; Hyperopt runs separately in notebook or job contexts. Native SMOTE is not implemented in DLT — class imbalance techniques are applied at model training time, not in data pipeline definitions. While DLT does materialize results as Delta tables, this option was correctly included; however, 'schema enforcement' is a Delta Lake feature that DLT inherits — notably, the three most directly pipeline-architecture-relevant capabilities are lineage, declarative definitions, and incremental processing.

3. A Unity Catalog-enabled workspace has a feature table registered at `main.feature_store.customer_rfm`. A data scientist on a separate team wants to read this table for exploratory analysis but should NOT be able to modify it. What is the correct way for a workspace admin to grant this access?

  • A. Grant `SELECT` privilege on `main.feature_store.customer_rfm` to the data scientist's user or group in Unity Catalog.
  • B. Grant `USAGE` privilege on the catalog `main` and schema `feature_store`, and `SELECT` on the table `customer_rfm`.✓ Correct
  • C. Share the feature table by calling `FeatureStoreClient.share_table()` with the target user's email address.
  • D. Set the table ACL to `PUBLIC READ` in the feature store UI, which automatically propagates to Unity Catalog.
Explanation

In Unity Catalog, access to a table requires a chain of privileges: `USAGE` on the catalog AND `USAGE` on the schema AND `SELECT` on the table. Granting only `SELECT` on the table (Option A) is insufficient because the user also needs `USAGE` on the parent catalog and schema to resolve the namespace. Option C is wrong; there is no `share_table()` method in the Feature Store API—cross-team sharing is handled via Unity Catalog privileges or Delta Sharing. Option D is wrong; there is no 'PUBLIC READ' ACL setting in the feature store UI that propagates permissions in this way.

4. A data scientist wants to register a feature table in the Databricks Feature Store so that it can be used for both model training and online serving. Which method from the `FeatureStoreClient` should they use to initially create and populate the feature table from a Spark DataFrame?

  • A. fs.write_table(name='…', df=df, mode='overwrite')
  • B. fs.create_table(name='…', primary_keys=['id'], df=df, schema=df.schema)✓ Correct
  • C. fs.register_table(name='…', primary_keys=['id'], df=df)
  • D. fs.publish_table(name='…', df=df, primary_keys=['id'])
Explanation

fs.create_table() is the correct API to both define and populate a new feature table in the Databricks Feature Store; it accepts the table name, primary keys, an optional DataFrame, and the schema. fs.write_table() is used to update an existing feature table after it has already been created, so using it first would fail. fs.register_table() does not exist as a Feature Store API method. fs.publish_table() is used to publish features to an online store (e.g., for low-latency serving), not to create the offline feature table.

5. A data scientist is working with a high-cardinality categorical feature `product_category` that has 500 unique values. They are concerned that one-hot encoding will produce an extremely wide, sparse feature matrix that degrades model training speed. Which alternative encoding strategy is MOST appropriate for a gradient-boosted tree model in this scenario?

  • A. Apply ordinal encoding, assigning integer codes 0–499 alphabetically, so the tree can split on integer thresholds.
  • B. Apply target encoding, replacing each category with the mean of the target variable for that category, computed on the training set.✓ Correct
  • C. Apply binary encoding, converting integer codes to binary representations to reduce dimensionality while preserving ordinality.
  • D. Apply one-hot encoding but limit it to the top 50 most frequent categories, dropping the rest.
Explanation

Target encoding replaces each category with the mean target value observed for that category, producing a single numerical column regardless of cardinality—ideal for high-cardinality features with tree-based models. It must be computed only on training data to avoid leakage. Option A (ordinal encoding) imposes a spurious order on unordered categories, which can mislead tree splits. Option C (binary encoding) reduces dimensionality but still introduces an artificial ordering via the intermediate integer step. Option D is a workable heuristic but discards information from 450 categories entirely, while target encoding uses all categories without dimensionality explosion.

38 more questions in this domain

Practice the full bank with instant grading, flashcards, and a timed mock exam.

Start practicing free