Lesson 3 of 3 Amazon SageMaker Feature Store

Building Training Sets and Governing Reusable Features

This lesson explains how features in Feature Store are kept correct over time, discovered by other teams and assembled into training datasets without leakage.

Learning outcomes

After completing this lesson, you will be able to:

  • Build point-in-time correct training datasets.
  • Evolve and govern feature groups.
  • Record feature lineage for reuse and impact analysis.

Point-in-time training datasets

Because the offline store keeps every record with its event time, training datasets can be built as of each label's timestamp. The SageMaker Python SDK's dataset builder joins a label DataFrame with one or more feature groups and returns, for each label row, the latest feature values with an event time before the label time. This is the point-in-time join that prevents future information from leaking into training. Athena queries on the offline store table can do the same with SQL.

The following diagram compares two ways of building a churn training set: reading today's values from the online store, and a point-in-time query on the offline store.

The churn training set built two ways. Reading the online store gives every customer today's values, so a customer who churned last March shows zero recent logins, information the model will never have before churn, and offline AUC of 0.97 collapses to 0.71 in production. A point-in-time query on the offline store at each label's date gives realistic AUC.
The scenario is illustrative.

Evolving and governing feature groups

Feature groups change over time. New features can be added to an existing feature group with UpdateFeatureGroup, but existing features cannot be removed or have their type changed, so a breaking change requires a new feature group and a migration of the models that use it. Records can be deleted, softly or permanently, to honour privacy requests.

Governance makes features reusable. Feature metadata, descriptions and parameters make features searchable in SageMaker Studio, so teams can find existing features instead of rebuilding them, and IAM policies control which roles can read or write each feature group.

Scenario questions

Evolve features safely

Exam skills 1.2.2 · 4.3.2

Choose how to change and govern shared feature groups.

Log in to try this activity Interactive activities are free with an account.

Feature lineage and reuse

Recording which pipeline produced each feature group and which models consume it supports audits and impact analysis: when a source system changes, the team can see which features and models are affected. Shared feature groups, such as customer demographics, avoid each team deriving the same values slightly differently, which would make models inconsistent with each other.

In multi-account organisations, resource policies allow cross-account access, so a central feature platform can serve several machine learning accounts. The following table summarises common management tasks.

TaskHow
Build leakage-free training dataPoint-in-time join with the dataset builder or Athena
Add a featureUpdateFeatureGroup with new feature definitions
Change a feature's typeCreate a new feature group
Honour a deletion requestDeleteRecord (hard delete)
Expire stale online valuesTime to live (TTL)
True or false

Reusing features

Exam skills 1.2.2

Check how teams find and reuse each other's features.

Log in to try this activity Interactive activities are free with an account.
Worked example

A leakage bug

A team builds a churn training set by reading the online store for each customer, then joins those features to churn labels from the past year. Offline AUC is 0.97; in production it is 0.71.

The online store holds only today's values, so a customer who churned last March has features that reflect their state after churning, such as zero recent logins. Rebuilding the training set with a point-in-time query against the offline store, using each label's date, gives realistic offline AUC that matches production.

Check yourself

Why should historical training sets never be built from the online store?

Show answer

The online store holds only the latest value per record. Training data needs point-in-time joins on the offline store to avoid leaking future values.

Exam Tips

Remember for the exam

  • Build training data from the offline store with point-in-time joins.
  • Never build historical training sets from the online store.
  • Feature types cannot be changed; create a new feature group.
  • DeleteRecord supports privacy deletion requests.
  • Discoverable feature groups encourage reuse across teams.