Skip to content

xpd feature-engineering

Use xpd feature-engineering to review the domain mechanism, publication cutoff, development-fold lift, separate feature and target transforms, grouping strategy, and sample weighting of a model pipeline.

The bare command lists findings, per-feature or per-hypothesis questions, and pipeline questions about the ablation scorer, feature exclusions, transforms, grouping, and weighting. Paths default to . or to those recorded by start. Use --kind, --limit and --since to compare or filter the display. --questions prints the catalog without a project. JSON lists read, findings, summary and checklist. Findings include their source rule and locations. read holds the manifest, graph and runtime facts. A static-only list has read.facts: null.

Terminal window
$ xpd feature-engineering --questions --format json | jq -c '[.questions[].id] | sort'
["ablation-scorer","availability","feature-exclusions","feature-transforms","grouping","lineage","mechanism","regimes","target-transforms","value","weighting"]
Terminal window
xpd feature-engineering [OPTIONS] [PATHS]...
xpd feature-engineering <COMMAND>
Subcommand What it does
xpd feature-engineering start Start a run: record the commit it starts from, the paths, line count, checks and optional benchmark of the project
xpd feature-engineering plan Record the plan of a round: the fixes in order, and the findings that are right as they are
xpd feature-engineering approve Record that the user said yes to a fix that changes what callers or users see
xpd feature-engineering gate Gate a fix that is committed: run the checks, time --bench when set, count lines and compare the findings with the commit before it. Exit 1 when the fix is not kept
xpd feature-engineering drop Record that a fix was given up, after its files were restored
xpd feature-engineering status Print the run and the stage that comes next
xpd feature-engineering finish End the run: compare findings, line count and benchmark timing with the start commit. Exit 1 while a fix is open or a new finding has no reason
Argument What it does
<PATHS>... Files or directories (directories respect .gitignore)
Option Default What it does
--kind <KIND> List only the findings of these kinds, separated by commas. Repeatable. Values: cols-left-to-dtype, encode-before-split, encoder-noise-without-seed, hashing-default-components, invalid-handle-option, named-cols-after-array-step, nan-into-pipeline, ordinal-mapping-pairs, ordinal-mapping-unknown, supervised-encoder-without-target, transform-with-test-target, wrapper-fit-returns-none, zero-regularization, node-mutates-input, predict-disabled-shape-check, auc-from-labels, cross-val-on-fitted-data, fit-before-split, fit-on-test, groups-ignored, leave-one-out-score, metadata-routing, metric-arguments-swapped, missing-groups, missing-random-state, pandas-output-sparse, pipeline-fit-params, prefit-before-cross-validation, scaled-target-without-inverse, scaler-fit-before-split, score-on-training-rows, stateful-function-transformer, transformed-target-pair, transformed-target-pipeline-weight, tune-on-test, unknown-scoring-name, add-lags-positive, column-capper-fraction, dataset-frame-and-xy, decay-on-shuffled-rows, decay-without-sample-weight, dict-mapper-not-int, estimator-transformer-proba, grouped-shrinkage-arguments, interval-encoder-ignored-span, monotonic-spline-without-positive, outlier-remover-before-model, outlier-threshold, pca-outlier-after-scaler, regression-outlier-column-name, scorer-called-as-metric, selector-without-feature-names, unseeded-random-estimator, native-predict-after-early-stopping, quantile-eval-without-train-ref, reused-early-stopping-callback, frame-column-write, indptr-missing-zero, local-robust-invalid-scale, boxcox-guerrero-without-season-length, global-target-without-inverse, target-robust-invalid-scale, weight-col-on-pipeline, future-exog-zero-horizon, mase-without-train-df, choose-log-nonpositive-low, joiner-conflicting-keys, minhash-murmur-with-minmax, minhash-odd-components-minmax, string-encoder-hashing-vocabulary, unfitted-keep-subsampling, arbitrary-outlier-capper-empty, decision-tree-encoder-unseen-no-fill, forecasting-nonpositive-periods, quantiles-capping-invalid-fold, smart-corr-missing-values-raise, smart-corr-model-performance-no-estimator, fippy-importance-on-training-rows, fippy-scalar-loss-function, fippy-conditional-without-sampler, fippy-loco-missing-set-y-train, optbinning-binning-before-split, optbinning-invalid-monotonic-trend, optbinning-user-splits-fixed-without-user-splits, optbinning-invalid-bin-size, optbinning-continuous-binning-woe-metric, interpret-ebm-monotonize-with-interactions, interpret-ebm-invalid-monotonize-args, interpret-ebm-unseeded-random-state, tslearn-dtw-conflicting-constraints, tslearn-dtw-mismatched-constraint, tslearn-soft-dtw-negative-gamma, tslearn-kmeans-unseeded-random-state, tslearn-kmeans-metric-params-mismatch, tslearn-dbscan-unnormalized-softdtw, tslearn-scaler-inverse-per-timeseries, tslearn-imputer-constant-missing-value, rolling-includes-current, rolling-crosses-groups, target-encoder-before-outer-cv, duplicate-feature-computation.
--limit <LIMIT> 20 The most findings to list of each kind, strongest first. 0 lists every finding.
--since <COMMIT> Count the findings at this commit too, and print each count beside the count of today.
--group-by <GROUP_BY> none Group findings and checklist items by owning module or shared cause. Values: none (Keep the default flat per-kind listing), module (Group findings and checklist items by owning module path), cause (Group related findings by shared kind and anchor files).
--packet <N> Emit one 1-indexed deterministic context-budgeted review packet for the Nth cluster.
--budget-lines <LINES> 300 Maximum source lines included across excerpts inside a --packet view.
--all-modules Include checklist review items for every surveyed module, not only modules with findings.
--format <FORMAT> Output format. Default: text on a terminal, json otherwise. Values: text, json.
--adapter <ADAPTER> A Python adapter file or shell command that emits development-fold evidence.
--questions Print the facts and questions catalog without scanning files.

Commit feature-engineering.json at the Git root. Without it the survey runs the pack and encoder rules and asks about scoring and exclusions for the pipeline. The rolling and duplicate checks, per-feature and representation questions, and --adapter need the manifest. Select every owning file. A feature needs an output column and can name a graph node that resolves once in its owner. A hypothesis can live in an existing project note. Use its original ID when implementing it. The ID pipeline is reserved for the pipeline-level checklist items.

feature-engineering.json
{
"target": "price",
"prediction_cutoff": "11:00 UTC on the day before delivery",
"development": {"snapshot": "training-2025", "holdout": "delivery year 2026"},
"baseline": ["hour"],
"pipeline": {"owner": "pipeline.py", "group_cols": ["hour"]},
"inputs": {"hour": "Delivery hour", "load": "Load forecast", "wind": "Wind forecast"},
"features": [
{"id": "residual", "name": "Residual load", "kind": "feature",
"owner": "features.py", "node": "residual_load", "column": "residual_load"}
]
}

An optional pipeline block sets owner (the file checked when gating a design fix for a pipeline question, defaulting to feature-engineering.json) and group_cols (candidate grouping characteristics such as delivery hour or entity ID measured per fold).

A rolling declaration has source (a parameter or literal column), optional group_keys and optional prior_only. The survey checks direct trailing windows, all-row supervised target encoding before outer cross-validation (across scikit-learn and feature_engine, including GridSearchCV, RandomizedSearchCV, HalvingGridSearchCV, HalvingRandomSearchCV, and OptunaSearchCV), exact arithmetic duplicates across declared nodes in one Driver, skrub joiner/encoder/DataOp contracts, feature_engine capping/lagging/correlation-selection contracts, fippy held-out predictive feature importance contracts (observation-wise losses, set_y_train, conditional samplers, and training-row evaluation), monotone spline and interval encoder contracts, nested CV seeding, sample-weight routing in scikit-learn, scikit-lego and MLForecast, shrinkage arguments on grouped estimators, reversible target transforms, and local scaler and exogenous lag contracts in CoreForecast, UtilsForecast and MLForecast. Prior-only declarations should reflect what was available at publication time.

A Python adapter defines review() and returns a mapping with these fields.

Field Contract
development pandas DataFrame with a unique nonmissing index of row IDs, raw predictors and the manifest target. Include timing and group metadata when needed. Load only the development partition.
splits Ordered pairs of training and validation row IDs. Supply at least two distinct splits with nonempty, disjoint sides.
mode time, group, both or iid.
prediction_time, label_available_time Column names for time mode. Use prediction timestamps sorted by row and split. The runner checks chronology and label publication.
group, justification Group column name for group mode or a reason for IID.
group_columns Optional list of candidate grouping columns (such as ["hour", "zone"]) to profile per fold alongside pipeline.group_cols and group.
build_features Callable receiving train_X, train_y, validation_X. Return aligned training and validation DataFrames and a dict mapping categorical feature IDs to pairs of raw training and validation Series.
make_estimator Callable receiving ordered column names. Return a fresh estimator with fixed settings and seeds. Put baseline preprocessing in this estimator.
variants Optional dict mapping representation variant names to callables make_estimator(columns) or dicts with make_estimator, optional columns, optional sample_weight(train_df), optional fit_params(train_df), optional metadata_routing: true (isolated inside sklearn.config_context), and optional category (feature-transforms, target-transforms, grouping, or weighting).
variant_columns Optional default column list passed to callable entries in variants (defaults to baseline).
score, metric, direction Callable receiving the fitted estimator, validation features and validation target. Declare the metric name and direction (loss or gain).

For supervised features, make training encodings out of fold under the inner time or group policy. Map validation using fitted training state. Any tuning or early stopping uses only the training partition.

A command adapter executes at the Git root of the measured tree and prints the same aggregate JSON (schema_version: 1, without raw rows or labels) as the bundled Python runner.

JSON section Contents
protocol development_fingerprint, split_fingerprint, development_rows, mode, baseline, metric, direction, and optional justification
folds[].boundary Row overlap, group_overlap when grouped, and UTC train_latest, validation_cutoff, and train_label_latest in time mode
folds[].baseline_stability Distribution and target-relationship stats (median, iqr, min, skew, zero_share, outlier_share, pearson_r, spearman_rho, nonlinearity_gap, or levels) for every baseline predictor
folds[].target_profile Inner training target min, max, median, IQR, skewness, zero share, outlier share, sign flags, intra-fold early_vs_late_median_shift and early_vs_late_iqr_ratio, and val_vs_train_median_shift
target_drift Across-fold target median range, median shift, IQR ratio, max intra-fold shift and IQR ratio, max validation shift, and sign flags
folds[].group_structure Per-group-column group_count, min and median group size, small_groups under 30 rows, target_eta_squared, target_spread_ratio, feature_scale_ratio, within_group_corr_range, and unseen_groups
folds[].variants, variants Per-fold score, reference_score, signed improvement, optional category, and across-fold mean plus range for each declared representation variant
folds[].stability Usable count, missing share, numeric median, IQR, min, skewness, zero share, outlier share, pearson_r, spearman_rho, nonlinearity_gap, or raw categorical level count
folds[].unseen Validation unseen numerator, denominator, rate, and missing count
folds[].clusters Training Spearman edges with pair counts and connected components
folds[].ablation Baseline-plus-one score, paired improvement, and mean plus range across folds (undefined values carry a reason)
Stage Purpose
start Record the committed baseline, checks and adapter.
xpd feature-engineering List current findings, measurements and checklist answers.
plan Record fixes, accepted findings and checklist verdicts.
gate Measure one committed fix against the last kept commit.
finish Close a run when all fixes and current questions are settled.
status Print the current run and next stage.
approve Approve a fix that changes an interface.
drop Record a reason for abandoning a fix.

See the feature review guide for the review sequence and xpd api xpd/recipe/feature-representation for runnable examples across all bundled feature libraries.

Status Meaning
0 The list or catalog printed, or the recorded stage succeeded.
1 The gate rejected a fix, or finish found open fixes, unexplained findings or unanswered items.
2 A manifest, adapter, protocol, plan or other command input was invalid.