# Feature engineering and serving contracts

Run `python feature_cases.py` from this directory. It executes original cases for NP-0381 through NP-0400 and writes `feature-verification.json`.

The cases are deliberately small and independent where one shared dataset would obscure an assumption. They cover fold-local target encoding, unseen categories, training-only scaling, missing indicators and imputation mechanisms, half-open time windows, nested selection, grouped permutation importance, exact two-feature Shapley arithmetic, schemas and freshness, dictionaries, validation, outliers, hashing collisions, train-only text vocabulary, trusted-artifact roundtrip, synthetic proxy review, identifier screens and a fixed-split ablation.

The SHAP article does not execute the external `shap` package. It uses exact two-feature Shapley values for a declared linear function and baseline. Attribution explains the specified model output under that baseline; it is not a causal effect.

Primary references: [scikit-learn preprocessing](https://scikit-learn.org/stable/modules/preprocessing.html), [ColumnTransformer](https://scikit-learn.org/stable/modules/generated/sklearn.compose.ColumnTransformer.html), [Pipeline](https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html), [feature selection](https://scikit-learn.org/stable/modules/feature_selection.html), [permutation importance](https://scikit-learn.org/stable/modules/permutation_importance.html), [FeatureHasher](https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.FeatureHasher.html), and [TfidfVectorizer](https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html).
