Data & preparation
Feature Store
Centralizes reusable model features and can support both offline training and low-latency online retrieval.
engineered feature rows + record id + event time
offline historical features and optional latest online features
Feature Store is not mandatory for every model; I use it when feature reuse, consistency and online lookup justify the additional platform layer.
Mental model
What this means before worrying about syntax.
Use it when governed feature definitions need reuse across training and inference, especially when online retrieval matters.
- Feature Group is the logical collection; record identifier + event time define records.
- Online Store is for latest low-latency feature lookup; Offline Store retains historical feature values for training/batch.
- The value is reuse, governance and training-serving consistency—not simply storing a table.
source data -> feature engineering -> Feature Store -> offline training / online inference
Implementation anatomy
The sequence you would actually build or configure.
- 1
Define feature schema, record identifier and event time.
- 2
Ingest via streaming/PutRecord or batch processing.
- 3
Use offline history for training datasets.
- 4
Use online lookup only for latency-sensitive serving features.
Concrete example
A real model-development or production flow.
card_id as record identifier
tx_count_5m, amount_sum_1h, merchant_risk_score as features
Offline history trains fraud model
Online latest values enrich a live authorization
Implementation lab
Concrete code, data manipulation and configuration for this lifecycle step.
Create feature rows with record id + event time
from datetime import datetime, timezone
features = {
"card_id": "CARD-10439",
"event_time": datetime.now(timezone.utc).isoformat(),
"tx_count_5m": 4,
"amount_sum_1h": 825.20,
"avg_amount_30d": 76.42,
"merchant_risk_score": 0.81,
}
Online lookup using Feature Store runtime
The Online Store lookup is by record identifier. Your application still has to parse and order the features for the model.
import boto3
fs_runtime = boto3.client("sagemaker-feature_store-runtime")
resp = fs_runtime.get_record(
FeatureGroupName="card-behavior-features",
RecordIdentifierValueAsString="CARD-10439",
)
feature_map = {
f["FeatureName"]: f["ValueAsString"]
for f in resp["Record"]
}
print(feature_map)
Point-in-time training idea
This is the core of training-serving correctness: historical training rows must not receive future feature values.
# PSEUDOCODE / SQL SHAPE
# For each transaction at time T, select the latest feature record
# whose event_time <= T. Never use a feature value created after T.
SELECT t.transaction_id,
t.card_id,
t.event_time,
f.tx_count_5m,
f.avg_amount_30d
FROM transactions t
LEFT JOIN feature_history f
ON t.card_id = f.card_id
AND f.event_time <= t.event_time
QUALIFY ROW_NUMBER() OVER (
PARTITION BY t.transaction_id
ORDER BY f.event_time DESC
) = 1
Design decisions that matter
- Which features truly need online storage.
- Freshness SLA and update frequency.
- Point-in-time correctness strategy.
Common failure modes
- Online Store is not the historical training database.
- Using future feature values during training creates leakage.
- Feature Store does not automatically inject features into an endpoint request.
Production readiness check
Items to close before treating this step as production-ready.