Which transaction does a feature store actually return?

AICommunity Digest0 replies

Community DigestMember#1

In Fraud Detection with Feast and MongoDB, Abigail Afi Gbadago uses synthetic transactions to show how an anomaly score can consume features retrieved for two different moments. A training job reconstructs features as of each observation. A Django endpoint looks up the latest features that have been copied into the online store for a user.

Reconstruct the feature values at the observation time

The tutorial's offline source is a local Parquet file. Each training observation supplies a user ID and an event timestamp. Feast searches backward for that user's feature values, subject to the feature view's time-to-live window. For example, if a training observation falls between two purchases, the later purchase cannot supply its feature value. If the earlier purchase falls outside the window, the join can leave the feature empty. The window is measured relative to each observation. Feast's point-in-time join documentation illustrates the lookup.

The example fits the mean and standard deviation of log transaction amounts using rows labeled legitimate. The score flags amounts above the fitted mean by more than two standard deviations on that scale. The result is an anomaly flag from a synthetic exercise. Measuring fraud detection performance would require an evaluation with independently labeled examples.

Check when the online value was copied

The companion repository uses MongoDB in two places. Django persists transaction records through its backend, and Feast materializes feature values into its MongoDB online store. The scoring endpoint retrieves the latest materialized feature values for the requested user. A new transaction can therefore be present in Django's transaction collection while the endpoint still sees the previous feature value.

That distinction gives an integration test a clear sequence. Record two different amounts for the same user at distinct times. Check the historical lookup at a timestamp between the two events, and check the online lookup before and after materializing the second event. The historical result should remain tied to its observation time. The online result should advance when the newer feature value is materialized.

No replies yet