Using the Same Feature Transformation at Serving Time

A deployed scoring path should apply preprocessing compatible with training, including the stored statistics and field order.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace an input with two features
  2. Verify a known transformed vector
  3. Reproduce one intermediate feature vector
  4. Test schema and missing policy as well as arithmetic

Trace an input with two features

If training uses temperature then humidity, reversing the positions at serving time gives the model different values even when both are numbers. Named record fields help preserve roles.

Verify a known transformed vector

Share one synthetic raw example across training and serving and compare resulting features. Fitted preprocessing supplies the stored scale and vocabulary.[1][2]

Reproduce one intermediate feature vector

Training saved mean ten and scale two for a named feature. For raw fourteen, both evaluation and serving should derive value two if they implement the same transform. Inspect the vector before model invocation to locate mismatch. See standardization from training data.

Training artifact: mean=10, scale=2, ordered field names
Input raw value 14
Expected model input: 2 for that field
Compare the actual exported serving path

Test schema and missing policy as well as arithmetic

An online field may be supplied in incompatible units or under a new name. Verify known, missing and unexpected values. Store preprocessing version alongside weights.

References

  1. Gareth James et al., An Introduction to Statistical Learning ↩
  2. scikit-learn Developers, Metrics and Scoring: Quantifying the Quality of Predictions ↩