Skip to content

FeatureGroup

Source: src/AWS/SageMaker/FeatureGroup.ts

An Amazon SageMaker Feature Store FeatureGroup — a typed, versioned table of ML features with an optional low-latency online store (for inference lookups) and an S3-backed offline store (for training).

With the online store enabled, functions read and write records at runtime via the AWS.SageMaker.GetRecord / AWS.SageMaker.PutRecord bindings.

import * as AWS from "alchemy/AWS";
const features = yield* AWS.SageMaker.FeatureGroup("UserFeatures", {
recordIdentifierFeatureName: "user_id",
eventTimeFeatureName: "event_time",
featureDefinitions: [
{ FeatureName: "user_id", FeatureType: "String" },
{ FeatureName: "event_time", FeatureType: "String" },
{ FeatureName: "clicks", FeatureType: "Integral" },
],
onlineStoreConfig: { EnableOnlineStore: true },
});
// init
const putRecord = yield* AWS.SageMaker.PutRecord(features);
const getRecord = yield* AWS.SageMaker.GetRecord(features);
// runtime
yield* putRecord({
Record: [
{ FeatureName: "user_id", ValueAsString: "user-123" },
{ FeatureName: "event_time", ValueAsString: new Date().toISOString() },
{ FeatureName: "clicks", ValueAsString: "42" },
],
});
const { Record } = yield* getRecord({
RecordIdentifierValueAsString: "user-123",
});