Feature pipeline of the Ml::Features module.
Events come in, per entity, and the vector the model expects comes out.
The module exists to stop the training features, computed in a Python notebook, and the serving features, computed here, from giving subtly different numbers. The model behaves in the lab and fails in the product, and nothing in the logs says why. Three things prevent it, all of them here: 1. The spec hash ('SpecHash', 'VerifyModelSpecHash'). A model trained with another spec is rejected. 2. The Python reference, which reads the same spec and gives the same numbers (the suite checks both on a corpus of fixtures). 3. The drift watch. The distribution of the output against the training one, with a report before the model degrades silently.
No allocations after 'Init'. The entity table, the windows and the sketches are all reserved in 'Init', at the size the spec asks for ('MemoryUsage' gives the figure before running). The table has a fixed capacity and an eviction policy, so a server that runs for months does not grow.
No virtual dispatch per event, and the aggregations are incremental. A window mean slides in O(1) as values enter and leave, and is never recomputed over the window.
Not thread safe. One pipeline per thread, or a lock held by the integrator.