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
Which write_table mode updates existing feature rows by primary key and inserts new ones?
- merge
- drop
- snapshot
- stream
Show answer
Answer: A. merge
mode='merge' upserts by primary key; rows not in the incoming data stay unchanged.
What is true after logging a model with fe.log_model(..., training_set=training_set)?
- The model stores the feature lookup specification
- score_batch can fetch the features from the primary keys
- The whole feature table is copied into the model artifact
- The model can no longer be registered
- 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.
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.
