Bird
Raised Fist0
MLOpsdevops~10 mins

Feast feature store basics in MLOps - Interactive Code Practice

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Feast client.

MLOps
from feast import [1]
Drag options to blanks, or click blank then click option'
AFeatureStore
BClient
CFeature
DStore
Attempts:
3 left
💡 Hint
Common Mistakes
Importing Client instead of FeatureStore
Using Store which is not a valid class
2fill in blank
medium

Complete the code to initialize the Feast feature store client.

MLOps
store = FeatureStore(repo_path=[1])
Drag options to blanks, or click blank then click option'
Arepo_path
BFeatureStore
C'/path/to/repo'
Dclient
Attempts:
3 left
💡 Hint
Common Mistakes
Passing variable names instead of string path
Omitting quotes around the path
3fill in blank
hard

Fix the error in the code to retrieve features from Feast.

MLOps
features = store.get_online_features(feature_refs=[1], entity_rows=entity_rows).to_dict()
Drag options to blanks, or click blank then click option'
A'driver.feature1,driver.feature2'
B'driver:feature1,driver:feature2'
Cdriver:feature1,driver:feature2
D['driver:feature1', 'driver:feature2']
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a list instead of a string
Using dot instead of colon in feature references
4fill in blank
hard

Fill both blanks to define an entity row and retrieve features.

MLOps
entity_rows = [{ '[1]': 1001 }]
features = store.get_online_features(feature_refs='driver:[2]', entity_rows=entity_rows).to_dict()
Drag options to blanks, or click blank then click option'
Adriver_id
Brating
Ctrip_count
Ddriver
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'driver' instead of 'driver_id' as key
Using wrong feature name in feature_refs
5fill in blank
hard

Fill all three blanks to create a feature view and register it.

MLOps
from feast import Feature, [1], ValueType

features = [Feature(name='[2]', dtype=ValueType.FLOAT)]
feature_view = [3](
    name='driver_stats',
    entities=['driver_id'],
    features=features,
    ttl=None
)
store.apply([feature_view])
Drag options to blanks, or click blank then click option'
AFeatureView
Btrip_duration
CDriverStatsView
DFeatureStore
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong class name for feature view
Using incorrect feature names
Confusing FeatureStore with FeatureView

Practice

(1/5)
1. What is the main purpose of Feast in machine learning workflows?
easy
A. To store and serve ML features consistently for training and serving
B. To train machine learning models automatically
C. To visualize data trends over time
D. To deploy ML models to production servers

Solution

  1. Step 1: Understand Feast's role

    Feast is designed to store and serve features, not to train or deploy models.
  2. Step 2: Identify the correct purpose

    It ensures features used in training and serving are consistent and reusable.
  3. Final Answer:

    To store and serve ML features consistently for training and serving -> Option A
  4. Quick Check:

    Feast = feature store for consistent features [OK]
Hint: Remember Feast is about features, not models or visualization [OK]
Common Mistakes:
  • Confusing Feast with model training tools
  • Thinking Feast deploys models
  • Assuming Feast is for data visualization
2. Which Feast command is used to fetch features for a given entity ID?
easy
A. feast apply
B. feast online-get
C. feast deploy
D. feast materialize

Solution

  1. Step 1: Review Feast commands

    feast apply sets up feature definitions, materialize loads data, deploy is not a Feast command.
  2. Step 2: Identify fetch command

    feast online-get is used to fetch features for specific entity IDs.
  3. Final Answer:

    feast online-get -> Option B
  4. Quick Check:

    Fetch features = online-get [OK]
Hint: Fetch features? Use online-get command [OK]
Common Mistakes:
  • Using feast apply to fetch features
  • Confusing materialize with fetching
  • Assuming deploy is a Feast command
3. Given this Python snippet using Feast client:
features = client.get_online_features(
    feature_refs=["driver:conv_rate", "driver:acc_rate"],
    entity_rows=[{"driver_id": 1001}]
).to_dict()
print(features)
What will be the output type of features?
medium
A. A dictionary with feature names as keys and lists of values
B. A list of feature names only
C. A string representation of features
D. An integer count of features fetched

Solution

  1. Step 1: Understand get_online_features output

    The method returns an object that can be converted to a dictionary with to_dict().
  2. Step 2: Analyze the dictionary structure

    The dictionary keys are feature names, and values are lists of feature values for each entity row.
  3. Final Answer:

    A dictionary with feature names as keys and lists of values -> Option A
  4. Quick Check:

    to_dict() output = dict of feature lists [OK]
Hint: to_dict() returns dict with feature keys and value lists [OK]
Common Mistakes:
  • Expecting a list instead of dict
  • Thinking output is a string
  • Assuming output is a count number
4. You run feast online-get but get an error: Entity ID not found. What is the most likely cause?
medium
A. The Feast CLI is not installed
B. The feature references are misspelled
C. The feature store is offline
D. The entity ID used does not exist in the feature store

Solution

  1. Step 1: Understand the error message

    'Entity ID not found' means the requested entity ID is missing in the store.
  2. Step 2: Check other options

    CLI not installed or store offline would cause different errors; misspelled features cause feature errors, not entity ID errors.
  3. Final Answer:

    The entity ID used does not exist in the feature store -> Option D
  4. Quick Check:

    Entity ID error = missing entity ID [OK]
Hint: Entity ID error means ID missing in store, not CLI or spelling [OK]
Common Mistakes:
  • Assuming CLI is missing
  • Blaming feature names for entity ID errors
  • Thinking store is offline without checking
5. You want to keep training and serving data consistent using Feast. Which two steps should you perform? Select the best pair.
hard
A. Fetch features randomly during serving, then define features later
B. Train model first, then define features in Feast after training
C. Define features in Feast, then fetch features by entity IDs during serving
D. Store raw data only, and transform features outside Feast

Solution

  1. Step 1: Understand Feast's role in consistency

    Feast ensures features are defined once and reused for training and serving.
  2. Step 2: Identify correct workflow

    Defining features first and fetching by entity IDs during serving keeps data consistent.
  3. Final Answer:

    Define features in Feast, then fetch features by entity IDs during serving -> Option C
  4. Quick Check:

    Define then fetch = consistent features [OK]
Hint: Define features first, fetch by entity IDs for consistency [OK]
Common Mistakes:
  • Training before defining features
  • Fetching features randomly
  • Ignoring Feast for feature transformations