Bitzu

Machine Learning Associate ยท Feature tables in Unity Catalog

Write, train and score with features

Writing data to a feature table (merge mode), building training sets with FeatureLookup and create_training_set, logging the model with the feature spec and scoring with score_batch.

Key points

  • Write with fe.write_table(name=..., df=..., mode='merge') to upsert rows by primary key.
  • Train by defining FeatureLookup objects (table_name, feature_names, lookup_key) and calling fe.create_training_set(df, feature_lookups, label).
  • Log with fe.log_model(..., training_set=...) so the model carries its feature spec.
  • Score with fe.score_batch(model_uri, df): you pass only keys and the features are looked up automatically.

Source: https://docs.databricks.com/aws/en/machine-learning/feature-store/train-models-with-feature-store

Practice questions

Single choice

Which write_table mode updates existing feature rows by primary key and inserts new ones?

  1. merge
  2. drop
  3. snapshot
  4. stream
Show answer

Answer: A. merge

mode='merge' upserts by primary key; rows not in the incoming data stay unchanged.

Select all that apply

What is true after logging a model with fe.log_model(..., training_set=training_set)?

  1. The model stores the feature lookup specification
  2. score_batch can fetch the features from the primary keys
  3. The whole feature table is copied into the model artifact
  4. The model can no longer be registered
  5. The label column is deleted from the feature table
Show answer

Answer: A. The model stores the feature lookup specification, B. score_batch can fetch the features from the primary keys

The feature lookup metadata travels with the model, so scoring only needs keys. The feature data itself is not copied into the model.

True or false

fe.score_batch requires the input DataFrame to already contain every feature column the model was trained on.

Show answer

Answer: False

False. The DataFrame needs the lookup keys; score_batch retrieves the features from the feature tables.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More Machine Learning Associate topics in this module