-
Defining and Storing Features and Labels: The
featureformlibrary provides anentitydecorator that can be applied to classes. This decorator allows you to associate features and labels with the entity using Featureform data sets that you’ve defined earlier. A feature typically comprises at least two columns: an entity column (similar to an index or primary key) and a value column. Optionally, it can include a third column for timestamps, which becomes essential for constructing point-in-time correct training sets. For example, consider a “User” entity with an “age” feature and a “credit score” label associated with it: -
Building Training Sets by Joining Features and Labels by Their Entity: To create a training set, you need to associate a label with a set of features based on their entity values. If both the label and features have timestamps, the feature value chosen is the one with a matching entity and a timestamp that is the closest (but earlier) to the timestamp of the label.
In the case of our “User” entity example, we can create a training set like this:
Alternatively, if the “User” class is in scope, you can use a convenient syntax to avoid explicitly specifying name/variant tuples:
-
Serving Features at Inference Time by Entity: The inference store retains the most recent value of each feature, indexed by its entity column. To retrieve features, you can utilize the
featuresmethod of a Featureform Client object.