Feature schema and lineage
Quick answer
A feature schema specifies the names, types, units, allowed values and missing-value policy of model inputs. Lineage records how a value was produced, from source revision through transformation version to the training artifact. Examples use standard-library Python; native Feast and Airflow are not executed. ByteMind execution is unverified.
Strict integer schema
rows=[{"value":12},{"value":True},{"value":"12"}]print([type(r["value"]) is int for r in rows])Expected output (locally tested): [True, False, False]. Boolean and text values fail a strict integer contract.
How it works
Consider a sensor feature measured in Celsius. An integer in the correct column is not sufficient if the source silently changes to Fahrenheit. A contract must specify units, feature version, entity key, event timestamp, availability timestamp and allowed null behavior. Batch ingestion processes bounded snapshots; streaming ingestion processes arriving events, possibly out of order or more than once. Use an immutable event identifier and reject conflicting duplicates instead of silently taking whichever row arrives last. Record source digests, transformation version, and output digest for each batch. A hash confirms identity relative to a trusted record, not correctness or access permission. Separate raw ingestion from validated feature computation; quarantine invalid batches without promoting them. Restrict service identities to the columns and entities they need. Preserve an original snapshot for replay, subject to retention policy. A version bump should be reviewed against the model contract rather than silently changing a deployed feature.
Detect conflicting delivery
seen={}for key,value in [("a",3),("a",3),("a",4)]: if key in seen and seen[key]!=value: print("conflict") else: seen[key]=valueExpected output (locally tested): conflict. Exact replay is harmless; conflicting reuse is flagged.
Common mistakes
Checking only field names misses units and type changes. In Python, bool is a subclass of int, so isinstance(True, int) is not enough for a strict integer contract.
Practice and next steps
Add a unit field to an event schema and reject a mismatching record. Explain which lineage metadata you would need to reconstruct the feature.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Feature schema and lineage — knowledge check
Apply feature schema and lineage to small examples and debugging scenarios.
What identifies a feature unit?
What does lineage reconstruct?
What should conflicting event IDs do?
What can a hash establish?
What should a stream tolerate?