Matlab Engineer Tabular Features
MathWorksOfficialCreated by MathWorks
- Skill
- Workflow
- Data and AI
- BSD-2-Clause
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a rigorous, data-driven workflow for feature engineering and selection in MATLAB. It manages the entire process from initial data intake and screening to feature pool generation, consensus-based selection, and diagnostic assessment. Designed for single-response supervised learning, it handles both tabular and non-tabular data by routing complex extractions to domain-specific skills. The workflow emphasizes train-test discipline, ensuring that feature generation and selection are performed on training data while maintaining a held-out set for unbiased evaluation. It concludes by delivering a self-contained inference script that allows users to reproduce the selected feature set on new data.
What it does
- Screens raw data to remove degenerate or constant predictors.
- Generates a candidate feature pool using either SMLT or domain-specific extractors.
- Performs consensus-based feature selection using a ranker panel and elbow-cut logic.
- Assesses feature set quality and stability through performance metrics and resampling.
- Produces a standalone MATLAB inference script for applying the selected features to new data.
- Generates comprehensive reports on the selection process and model-free feature quality.
When to use it
- When you need to engineer and select the best predictors for a single-response classification or regression task.
- When you require a structured, reproducible selection process rather than ad-hoc feature picking.
- When working with non-tabular data that requires specialized extraction before feature selection.
- When you need a reliable, self-contained script to apply your feature engineering pipeline to future datasets.
Advantages
- Enforces strict train-test discipline to prevent data leakage.
- Provides a consensus-driven approach to feature selection that reduces bias.
- Offers diagnostic tools to evaluate feature set stability and predictive performance.
- Delivers a portable inference script that encapsulates the entire transformation logic.
Usage examples
- “I have a table of sensor data and want to select the best features for a regression model.”
- The agent will initiate the intake phase, confirm your output directory, and guide you through the feature engineering and selection workflow.
- “Can you help me select features for my classification task and check if they are stable?”
- The agent will perform the selection and then offer to run stability gates to see if the same features are chosen across resampled data.
Install
8 of its files are not mirrored here, so install it from its source:
https://github.com/matlab/matlab-agentic-toolkit/tree/2a7f215e965597acf6ed495beb9e7b8aff45a3be/skills-catalog/ai-and-statistics/matlab-engineer-tabular-features
Documentation by MathWorks
Engineer Tabular Features
A lean, functional pipeline: intake → feature pool → select → assess →
deliver → report. There is no shared context object — each phase is a direct
call to leaf utilities in scripts/, and the reference file for each phase
carries the detail. Your value is the structured, data-driven process and,
above all, the consensus selection at its center — not an ad-hoc answer.
This skill bundles the workflow in references/ (per-phase detail read on demand)
and scripts/ (the computation and plotting utilities). Do not invoke files in
references/ as separate skills — they are loaded only via the Read tool when
the phase that needs them runs. The per-phase files call the pipeline's leaf helpers
for you; if you ever need a helper's signature,
references/internal-helpers.md documents each one's
inputs, outputs, and an example call — so you never open a helper's source.
When to Use
Engineering or selecting the best predictors for single-response supervised classification or regression on a plain in-memory
table.You want a structured, data-driven selection — a ranker panel, a consensus vote, and an elbow cut — rather than an ad-hoc hand-picked feature set.
The data is non-tabular (signals, images, battery/machinery telemetry): this skill routes extraction to the matching domain skill, then engineers, selects, assesses, and delivers on the resulting table (see references/domain-routing.md).
When NOT to Use
Multi-response problems — this skill is single-response only.
Model training, tuning, or deployment — it prepares features and stops. Hand the delivered table to a model-training/classification workflow to fit and compare models.
Raw data acquisition. And for the extraction step on non-tabular data, the actual feature computation belongs to the matching domain extraction skill — this skill orchestrates that handoff (see references/domain-routing.md), it does not re-implement it.
Requires the Statistics and Machine Learning Toolbox (SMLT) —
gencfeatures/genrfeatures build the pool and the ranker/assessment utilities
are SMLT-based. MATLAB Report Generator is optional (enables the PDF report;
markdown is always produced).
Running MATLAB
Run all MATLAB through the MATLAB MCP server (mcp__matlab__evaluate_matlab_code,
or mcp__matlab__run_matlab_file for scripts). Set project_path to this skill's
scripts/ directory so the utilities resolve on the current working folder
without any addpath calls. Every utility is a leaf function called directly —
there is no initialization step and no context object to construct. Validate any
code you author with mcp__matlab__check_matlab_code before running it.
Start each dataset from scratch — but use the live workspace within a run. The
MCP session is stateful, so a run's intermediates should live in the workspace: set
RawTbl, Splits, FullEng, SelectedNames, Baseline, etc. once and pass them
phase-to-phase. Do not round-trip them through save/load .mat files (noise,
risks stale reads) and do not addpath. Across different datasets/runs, carry
nothing — begin each analysis by setting every variable afresh.
Communication style while running this skill
Talk to the user about their data and results, not the skill's plumbing.
Everything under references/ and scripts/ is internal. Rule of thumb: if a
sentence would only make sense to someone who has read this skill's source files,
don't say it.
Never name internal files, helpers, or phase/gating mechanics.
runConsensusSelection,GenInfo.BinaryReliant, "the redundancy dimension", etc. are internal — give the outcome ("these features duplicate each other, so I'm keeping the strongest"), not the mechanism. Name an internal only when it is a problem the user can act on. Read reference files silently.Use plain words for each check. The three assessment reads: performance → whether the new features improve predictions (a held-out estimate, or a cross-validated mean ± std); fixed-pool stability → whether the same features get picked when rows are resampled; generation stability → whether the same features get built and picked when the whole pipeline re-runs on resampled rows. Say "the ranking step" not "the borda voter"; "reliably re-selected" not "consensus core".
Don't narrate uncertainty or mid-flight course-corrections — settle how a function is called silently, then report only the outcome. Surface a difficulty only when the user must decide on it.
Announce cost before long work, one sentence — pool size before selection, expected time before a K-fold, and before either stability gate (both re-run selection many times; the generation gate also re-builds the pool each time). And surface user-facing questions verbatim where a phase specifies one (output directory, wide-input, domain routing).
Report what was dropped at every phase (screened predictors, excluded WoE columns, skipped rankers) — a silent shrink reads as data loss. But selection evaluates the pool, it doesn't necessarily shrink it — never call it a reduction.
Output directory — REQUIRED, HARD HALT
Deliverables are written to disk. Always confirm the output directory with the user before writing anything. Do not assume the working directory, do not create one silently.
The pipeline
Follow the phases in order. Each links to its reference; read the reference before executing the phase.
1. Intake — references/intake.md
Ask before running any code. Intake is a required conversation, not a
default-fill. Confirm every run parameter with the user before proceeding past
the screen — data source, response, dataset name, output directory (hard-halt),
domain description, separate-test-set, model family (+ lens if agnostic),
evaluation strategy, report opt-out — asked one at a time, in the order pinned in
intake.md §1 (never dump the whole list in one message).
Every item must be asked; offer a default where one exists, but confirm rather than
assume — when the opening request implies an answer, state what you inferred and
have the user confirm it. Two are
non-negotiable — do not proceed without an explicit answer:
Output directory — the disk-write hard-halt (see above).
Domain description — the sole input to domain routing. Ask what the data is and where it came from; route to a domain extractor if one fits, else the generic path. Never infer the domain from column names or fall through to generic generation on silence. Verbatim prompt in intake.md.
Then assemble the data into one plain table, briefly confirm what was
loaded (shape, response, problem type), and screen degenerate predictors. A
timetable/tall/gpuArray/datastore isn't a dead end — it's a signal to run a
tabularizing step first (often a domain skill, see
domain-routing.md) and then re-enter intake with
the resulting table; only halt if no tabular path exists.
[ScreenedTbl, ScreenInfo] = screenPredictors(RawTbl, Response); % or (X, y)screenPredictors handles the polymorphic response (a name already in the table,
or a separately-supplied vector/table it concatenates) and drops constant and
near-empty predictors. Then profile, reserve the user's untouched slice, and split:
Profile = profileForSplit(ScreenedTbl, ScreenInfo.ResponseVar);
[WorkingIdx, UserHeldOutIdx, ReserveInfo] = reserveHoldoutForUser( ...
ScreenedTbl, Profile.ProblemType, ScreenInfo.ResponseVar, ReserveForUser = HasNoSeparateTest);
[Splits, SplitDecision] = splitStrategy(ScreenedTbl, Profile.ProblemType, ...
ScreenInfo.ResponseVar, Subset = WorkingIdx, EvaluationStrategy = EvaluationStrategy);reserveHoldoutForUser sets aside an untouched slice for the user's own testing
when they have no separate test set (default 20%, user-settable via HoldoutFraction;
else nothing); the rest is the working data all phases run on. When a carve
happens, materialize the slice as the table variable's name + _test from the original
rows and narrate the split in plain words (fraction, row counts, and method —
stratified/random — from ReserveInfo); see intake.md. splitStrategy then sets
Splits.TrainIdx/.TestIdx over the working rows — a train/test split under
holdout, or all working rows with empty TestIdx under cross_validated.
Generation and selection run on TrainIdx only.
2. Feature pool — references/feature-pool.md
Produce the candidate pool. First check whether a domain skill fits the data (references/domain-routing.md); otherwise use the default SMLT path:
Opts.TargetModel = TargetModel; Opts.Standardization = "auto";
OptArgs = namedargs2cell(Opts);
TrainIdx = Splits.TrainIdx; TestIdx = Splits.TestIdx;
TrainTbl = ScreenedTbl(TrainIdx, :); % fit generation on train rows only
[~, Transformer, GenInfo] = generateFeatures(TrainTbl, Response, ProblemType, OptArgs{:});
Recipe = Transformer; % SMLT recipe (domain path: the captured struct)
FullEng = transformFeatures(Recipe, ScreenedTbl); % engineered pool over ALL rows
FullEng.(Response) = ScreenedTbl.(Response); % transformFeatures returns predictors onlyGenerate-only (external consensus does the cutting). Mind the wide-input guard
(generateFeatures:tooManyPredictors) — hold the wide-input conversation and
re-call with Opts.NumFeatures set. FullEng is the canonical pool: engineered
over all rows with the response re-attached, train-fit so the held-out rows
stay leakage-clean. On the domain path the captured table already spans all
rows — use it as FullEng directly. Whichever path runs, downstream reads only
the pool contract (Recipe, describeFeatures, transformFeatures) — never
the producer. Announce GenInfo.PoolSize.
Set OriginalData/OriginalPredVars here — the baseline's "original" reference is
path-dependent (raw columns when they exist, else the full pool). assess.md §1 pins the rule.
3. Select — references/select.md
The heart of the skill. One call runs the ranker panel, the consensus vote, and the elbow cut:
[SelectedNames, VoteTable, PanelInfo] = runConsensusSelection( ...
FullEng(TrainIdx, :), Response, ProblemType, ExcludeFeatures = GenInfo.BinaryReliant, ...
TargetModel = TargetModel);Selection runs on the training rows only — slice FullEng(TrainIdx,:); the
held-out rows never enter ranking. TargetModel gates the ranker panel: a declared
family runs its own embedded probe (linear→lasso, tree_ensemble→oob,
kernel_distance→nca) plus the two model-agnostic rankers; agnostic (the default)
keeps the full five-ranker panel. Report PanelInfo.Reasoning. Build a
plotSelectionConsensus figure only when the report is on (GenerateReport) —
every figure is a report input, so a report opt-out skips all plot calls.
The score elbow alone sets the count (see select.md); when the scores decline too gradually to show a knee the full pool is kept — report a keep-all as "the candidates are comparably useful," not as a failure to select.
4. Assess — references/assess.md
Diagnostic only; never revises the delivered set. The performance read follows the evaluation strategy chosen at intake:
Quality = featureSetQuality(ScreenedTbl, FullEng, TrainIdx, Response, ...
OriginalPredVars, SelectedNames, ProblemType); % model-free, always
if Splits.Strategy == "holdout" % point estimate on the held slice
Baseline = baselineComparison(ScreenedTbl, FullEng, TrainIdx, TestIdx, Response, ...
OriginalPredVars, SelectedNames, ProblemType, TargetModel = TargetModel, InternalCV = false);
else % cross_validated: folds ARE the estimate
KFold = assessKFold(ScreenedTbl(TrainIdx, :), Response, ProblemType, CVP, TargetModel = TargetModel);
end
% Stability — two independent opt-in gates, both default OFF (assess.md §3):
rng(0, "twister");
SelStab = assessSelectionStability(StabEng, Response, ProblemType, ... % Gate 1 (fixed pool)
ExcludeFeatures = StabExclude, TargetModel = TargetModel, MaxRows = RowBudget);
GenStab = assessGenerationStability(RawTrainTbl, Response, ProblemType, ... % Gate 2 (pool regenerated)
TargetModel = TargetModel, MaxRows = RowBudget);Pass a row budget to both gates as MaxRows only when the user named one
("~1000 patients is fine" → MaxRows = 1000) to keep the audit affordable; else
omit it (default 3000) — don't pass an empty value.
Quality (model-free representation quality) and the strategy's performance read
are unconditional: under holdout, baselineComparison scores the held
TestIdx as a point estimate (InternalCV = false, no error bars); under
cross_validated (TestIdx empty), assessKFold is the headline (regenerates per
fold, reports mean ± std, performance-only) — skip baselineComparison.
Stability is two independent opt-in gates, both default OFF (see
assess.md §3): Gate 1 SelStab (re-selects on a fixed
pool) and Gate 2 GenStab (also regenerates the pool per subsample; needs a
re-runnable fitter — SMLT by default, a domain path needs Recipe.Fit, §3c). Both
are computationally expensive — each re-runs the consensus selection M times, and
Gate 2 adds a full regeneration on top — so both stay off unless asked for. Both
grade the procedure; neither revises the delivered set. Offer the choice, don't
default them on, and announce the cost — ask "Want a stability check — would the
same features get picked if the data were resampled? It re-runs selection many times
so it takes a while; a deeper version also re-builds the features each time, costing
more again." and run only what the user opts into. When neither is requested, add
neither and set Results.StabilitySkipped = true (report says "not requested"). Skip
a requested gate automatically with that flag when the pool has < 2 features or < 2
subsamples are possible.
5. Deliver — references/deliver.md
Write the artifacts to the confirmed output directory:
[ScriptPath, MatPath] = writeInferenceScript(Recipe, SelectedNames, OutputDir, ...
DatasetName = DatasetName, ResponseVar = ResponseVar);
SelectedTbl = selectFeatures(Recipe, RawTbl, SelectedNames); % in-workspace CHECK only — do NOT write to diskThe recipe is the inference recipe — fe_transform_<dataset>.m +
its companion .mat reproduce the exact selected set on new raw data with one
call. writeInferenceScript is generator-agnostic (SMLT FeatureTransformer or a
Kind=="domain" recipe) and inlines its logic, so the deliverable stands alone.
SelectedTbl is only a verification value — never write the feature table to
disk (features_<dataset>.mat/.csv); the inference script regenerates it on
demand, so a materialized dump is redundant. Write the figures' fig_*.svg
alongside only when the report is on; under a report opt-out the inference
script + state are the whole deliverable.
Also save the full Results struct unconditionally — every run result at full
resolution, so nothing a plot or a truncated table only previews is lost:
ResultsMatPath = saveResults(Results, OutputDir, DatasetName = DatasetName);This fe_results_<dataset>.mat ships even on a report opt-out (assemble Results
first — see report.md). Tell the user it exists, and that
the same data is live in the Results workspace variable this session.
6. Report — references/report.md
Optional (opt-out, default on) — run only if the user kept the report at intake
(GenerateReport == true), the same flag that gates every figure in
Select/Assess/Deliver. When run, assemble the plain Results struct from every
prior phase and emit:
MdPath = generateFeatureReport(Results, OutputDir); % always
if hasReportGenerator(); PdfPath = generateFeatureReportPdf(Results, OutputDir); end % if available7. Hand off to model training (offer, don't invoke)
This skill stops at features. If the user's ask mentioned training a model (supervised learning, classification, regression, etc.) and an installed skill covers tabular model training, name that candidate once at close-out and offer to hand off — semantic match against the injected skill list, confirm before invoking, no hardcoded skill names (same discovery rule as domain-routing.md). If nothing fits or the ask was features-only, stop silently.
Behavioral contract (all phases)
Train/test discipline — generation, selection, and all training-side statistics use the training rows only; the test rows certify the delivered artifact and are never seen before then.
Generator-agnostic downstream — after the pool phase, touch generator internals only through
describeFeatures/transformFeatures.No hidden truncation — if you cap, sample, or skip anything, say so.
Never fabricate a pool — when routing offers a choice, or the data needs a tabularizing step this skill can't perform, presenting the choice or asking ends the turn. Wait for the user before building the pool by any means (domain skill, generic path, or an extractor of your own).
Confirm outward-facing actions — writing to disk is confirmed once at intake (the output-dir hard-halt); don't write outside it.
MathWorks Coding Guidelines for any MATLAB you author (lowerCamelCase,
argumentsblocks, ≤6 in / ≤4 out,endterminators; modern APIs).
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks.
Copyright 2026 The MathWorks, Inc.
Files
- ATTRIBUTION.mdAdded by AutoGineer1.1 KiB
- LICENSELicence file added by AutoGineer1.4 KiB
- SKILL.md18.9 KiB
- manifest.yaml570 B
- references/assess.md16.7 KiB
- references/deliver.md13.0 KiB
- references/domain-routing.md18.1 KiB
- references/feature-pool.md10.9 KiB
- references/intake.md16.9 KiB
- references/internal-helpers.md12.2 KiB
- references/provider-protocol.md12.3 KiB
- references/report.md9.7 KiB
- references/reproduce-pool.md7.1 KiB
- references/select.md7.1 KiB
- scripts/BordaVoter.m2.3 KiB
- scripts/ConsensusVoter.m2.5 KiB
- scripts/MajorityVoter.m2.0 KiB
- scripts/RRFVoter.m1.9 KiB
- scripts/assessGenerationStability.m11.9 KiB
- scripts/assessKFold.m20.6 KiB
- scripts/assessSelectionStability.m9.8 KiB
- scripts/baselineComparison.m18.9 KiB
- scripts/buildRecipe.m8.2 KiB
- scripts/chooseNumBins.m5.0 KiB
- scripts/chooseStandardization.m4.5 KiB
- scripts/computeNSelect.m2.9 KiB
- scripts/createConsensusVoter.m2.2 KiB
- scripts/describeFeatures.m5.1 KiB
- scripts/expandBlockMap.p(opens on GitHub)Not mirrored: opens on GitHub440 B
- scripts/featureSetQuality.m12.3 KiB
- scripts/generateFeatureReport.m67.2 KiB
- scripts/generateFeatureReportPdf.m64.9 KiB
- scripts/generateFeatures.m14.6 KiB
- scripts/hasReportGenerator.m630 B
- scripts/isDomainRecipe.m1.4 KiB
- scripts/isStringEmpty.m577 B
- scripts/lambdaSequence.p(opens on GitHub)Not mirrored: opens on GitHub637 B
- scripts/lassoFeatureRanking.p(opens on GitHub)Not mirrored: opens on GitHub971 B
- scripts/macroF1Score.m931 B
- scripts/mrmrFeatureRanking.p(opens on GitHub)Not mirrored: opens on GitHub239 B
- scripts/mutualInformationPanel.p(opens on GitHub)Not mirrored: opens on GitHub1.1 KiB
- scripts/ncaFeatureRanking.p(opens on GitHub)Not mirrored: opens on GitHub464 B
- scripts/nogueiraStability.m3.8 KiB
- scripts/oobFeatureRanking.p(opens on GitHub)Not mirrored: opens on GitHub414 B
- scripts/plotSelectionConsensus.m2.7 KiB
- scripts/plotSelectionDecision.m6.3 KiB
- scripts/plotSelectionStability.m10.2 KiB
- scripts/plotValidationBaseline.m6.1 KiB
- scripts/printSummary.m18.3 KiB
- scripts/profileForSplit.m6.2 KiB
- scripts/rankAgreement.m1.3 KiB
- scripts/rankFeatures.m6.2 KiB
- scripts/reserveHoldoutForUser.m5.5 KiB
- scripts/runConsensusSelection.m9.4 KiB
- scripts/sampleSkewness.m600 B
- scripts/saveResults.m2.1 KiB
- scripts/scoreFeaturePanel.p(opens on GitHub)Not mirrored: opens on GitHub1.6 KiB
- scripts/screenPredictors.m13.3 KiB
- scripts/selectFeatures.m2.3 KiB
- scripts/splitStrategy.m5.4 KiB
- scripts/stratifiedDownsampleRows.m2.2 KiB
- scripts/stratifiedSubsampleIndices.m3.4 KiB
- scripts/transformFeatures.m6.1 KiB
- scripts/validateRecipe.m12.3 KiB
- scripts/writeInferenceScript.m10.5 KiB
references/intake.md
Intake — collect the run, assemble the table, screen it
Intake gathers everything the run needs, turns the user's data into one plain in-memory table of predictors + response, and removes predictors that would be dead weight for any producer. Everything after this phase — profiling, splitting, generation, selection, assessment, delivery — operates on that screened table.
Intake does three things, in order:
Collect the run parameters — the full list, with rationale and asking order, is §1 below.
Assemble & gate — load the data into a plain table, halt on unsupported container types.
Screen — drop constant and mostly-missing predictors before anything downstream sees them.
Ordering invariant — the split precedes any fitted extraction. The train/test split is a function of the response and the observation set, never of the features, so deciding it early introduces no leakage. On the ordinary tabular path this is automatic: assembly yields the full table, and the split (see Handing off) runs before
generateFeatures(TrainTbl, …). On the domain-routed path, extraction happens during assembly, so problem type and the split must be settled first — over the raw observations, from the response — and carried into the domain skill so any fitted extraction state is trained on the training observations only (domain-routing.md §4). Triggering a domain extractor before the split is decided is the leakage bug to avoid: it fits extraction on all rows.
1. Collect
Ask the user for these. Confirm each rather than guessing.
| Item | Why it's needed |
|---|---|
| Data source | a .mat path + variable, a workspace variable, or a predictor table + a separate response vector |
| Response | the target: a column name already in the table, or a separately-supplied vector of values (see the polymorphic response below) |
| Dataset name | names the deliverables (fe_transform_<dataset>.m, report files); sanitized to a valid identifier |
| Output directory | where deliverables are written — hard-halt, always confirm before writing anything |
| Domain description | Always ask — required, not optional. Free text describing what the data is and where it came from; it is the sole input to the domain-routing decision (domain-routing.md), which determines whether the pool is built by a purpose-built domain extractor or by generic generation. Do not infer the domain from column names and do not proceed to generation without an explicit answer. See the verbatim prompt below |
| Separate test set? | Always ask. If they have no separate test set, reserveHoldoutForUser sets aside a slice untouched for their own testing (default 20%) and the rest becomes the working data; if they do, the whole dataset is working data. State the 20% default and let them override the fraction — captured as ReserveFraction, passed through as HoldoutFraction; don't ask for a number separately, just offer the default so they can accept or change it |
| Model family | agnostic (default) | tree_ensemble | linear | kernel_distance — steers generation ordering, the selection ranker panel, and the baseline panel. agnostic trains all three families and runs the full 5-ranker panel; a declared family trains through that family alone and gates selection to its own probe + the model-agnostic rankers. A model name outside this taxonomy is handled gracefully — see below |
| Primary lens (agnostic only) | which of the three families headlines the baseline — bag (default, the bagged ensemble) | linear | kernel. Ask only when the family is agnostic; state the default and offer the override (see below). A declared family already fixes its own lens, so skip this |
| Evaluation strategy | how the working data is evaluated — holdout (one train/test split, point estimate) or cross_validated (k-fold, mean ± std). Recommend by size, always confirm (below) |
| Report | generate the written report at the end? Default yes — offer opt-out here so the cost is known up front (report.md). Captured as GenerateReport, this gates both the report and every figure (the fig_*.svg plots exist only to illustrate it, so an opt-out skips all plotSelection*/plotValidation* calls). The inference script + state .mat ship either way |
| Row budget (optional) | if the user volunteers a working-set size for speed ("~1000 rows is fine"), pass it to the stability gates as MaxRows; don't ask proactively. Unset → default 3000 |
The model family, domain description, evaluation strategy, report choice, and any row budget feed later phases — capture them now even though they aren't used until generation, assessment, and reporting.
Gate before proceeding. Collect is a required conversation, not a silent
default-fill. Before running any code past screenPredictors, get an explicit
answer to every item in the table above — missing any, ask; do not assume the
default and move on. The output directory and the domain description in
particular must have explicit user answers before generation.
Ask one at a time — don't dump the list. Every item below must be asked and
answered — offer a recommended default where one exists (so the user can just say
"sounds good"), but never silently assume it or skip a question because the opening
request seems to cover it. Where you inferred something from that request, state
what you inferred and have the user confirm it — a confirmation is an answer; an
assumption is not. Walk through it conversationally in this order: (1) data source,
response, dataset name; (2) output directory (the hard-halt); (3) domain description
(the routing input); (4) separate-test-set (with the reserve fraction, default 20%,
when they have none); (5) model family (+ primary lens if agnostic); (6)
evaluation strategy; (7) report opt-out. A short guided exchange, not a form.
Asking about the domain. State it plainly and wait for an answer — the routing decision cannot be made without one: "Before I build features, tell me what this data is and where it comes from — the subject matter, how it was measured or collected, any domain it belongs to (sensor signals, financial records, clinical measurements, and so on). If a specialized extractor fits your domain I'll route to it for far better features than generic generation; if it's ordinary tabular data, say so and I'll use the generic path." Do not infer the domain from column names, and do not fall through to generic generation on silence.
Recommending the strategy. Favor holdout when a 20% slice of the working
data is a trustworthy test (rough guide: a few hundred+ rows, and for
classification ~30+ minority-class rows in the slice); favor cross_validated
when the data is too scarce for one split to be reliable. State the recommendation
with its one-line reason and let the user override. Either way the delivered
recipe is refit on all working data — see deliver.md.
Primary lens under agnostic. The agnostic baseline panel trains all three
families but headlines on one of them — its metrics become the reported
top-line and drive cross-validation. Don't expect the user to raise this; state
the default and offer the choice: "With an agnostic model I'll headline the
baseline on the bagged ensemble by default — tell me now if you'd rather headline
on linear or kernel." Record their answer as the primary lens; leave it at the
bagged-ensemble default otherwise. This applies to agnostic only — a declared
family already fixes its own lens, so there's nothing to ask.
Out-of-taxonomy model names. Users name specific models ("discriminant", "QDA",
"kNN", "naive Bayes") that aren't one of the four families. Don't reject or silently
coerce: say you won't train that model (the skill stops at features), then map by
inductive bias to the closest family — linear surface → linear; distance/kernel or
quadratic → kernel_distance; trees → tree_ensemble; no clean proxy → agnostic
(trains all three lenses). Name the proxy and which baseline column to watch, and
record the mapping in the report's intake summary.
2. Assemble & gate
Load the data into a plain in-memory table. This skill operates on an
ordinary in-memory table — that is its input contract, not a restriction on where
the data may originate:
A plain
table(or a numeric/categorical matrix that reads cleanly into one) proceeds directly.A
timetable,tall,gpuArray,datastore, or other non-plain container does not proceed as-is, but this is not a dead end — it means a tabularizing step must run first. Many such containers are the raw form of a domain modality that a domain skill (or a simple conversion) turns into a table: check domain-routing.md, run that step, then re-enter intake with the resulting table. Only halt outright when no tabular path exists (e.g. genuinely out-of-memorytall/datastoredata that can't be materialized). Never silently coerce — say what was received and confirm the tabularizing step with the user before running it.Finish Collect before any tabularizing step runs. Response, problem type, and the split policy are decided first (they need only the raw observations and their labels, which exist pre-extraction), then handed to the domain skill so its extraction fits on training observations only. Do not trigger a domain extractor the moment a non-tabular container is detected — that runs extraction before the split exists and leaks. See the ordering invariant above and domain-routing.md §4.
Confirm what was loaded. Once the table is assembled, state back what you have
before generating anything: the observation count, the predictor count, the
resolved response column, and the detected problem type (classification vs.
regression, with the class balance for classification). One or two sentences — it
lets the user catch a wrong variable, a mis-detected problem type, or an unexpected
row count before the pipeline runs on it. If profiling has not run yet, state the
shape and response now and the problem type right after profileForSplit.
Polymorphic response — one table either way
The response may already be a column of the loaded table, or it may arrive as its
own variable (the common "X table + y vector" shape). screenPredictors handles
both — its Response argument is polymorphic, so you pass through the same call
regardless:
Response is a NAME (a scalar string): it identifies the response column already in the table (a Wilkinson formula like
"Y ~ x1 + x2"is also accepted, its left-hand side naming the column to protect).Response is DATA (a column vector, a string array of labels, or a single-variable table): it is the separately-supplied response, and gets concatenated to the predictors before screening. A nameless vector is appended under
ResponseName(default"Response"); a single-variable table is self-naming — its own variable name becomes the response column name.
This is why assembly and screening are a single step: screenPredictors does the
concatenation, so downstream always receives one predictors + response table.
3. Screen — screenPredictors
Run the light-weight structural screen before profiling, splitting, or generation. It drops two kinds of useless predictor so no producer or ranker wastes effort on them:
Constant predictors — effectively one distinct non-missing value (zero variance; nothing to learn, and a source of degenerate transforms). Numeric columns use a scale-relative
ConstantTolerance(default1e-9) so floating-point noise around a single value still counts as constant while a column with real, if small, variation is kept; non-numeric columns use an exact distinct-value count.Mostly-missing predictors — more than
MissingThreshold(default 0.95) of rows missing (effectively empty). The cutoff is intentionally high: many learners and the generator's own imputation handle moderately-missing columns natively, so intake prunes only the near-empty ones and leaves the missingness call to the producer.
% Response already a column of RawTbl:
[ScreenedTbl, ScreenInfo] = screenPredictors(RawTbl, Response);
% Response supplied separately as a vector -> concatenated as "Response":
[ScreenedTbl, ScreenInfo] = screenPredictors(X, y);
% ...or under a chosen name, with a stricter missing cutoff:
[ScreenedTbl, ScreenInfo] = screenPredictors(X, y, ...
ResponseName="Target", MissingThreshold=0.3);Key behavior (full rationale in the function header):
The response column is never screened — it is always kept, whatever its contents.
Structural, not response-dependent. The screen never inspects response values, so running it on the whole table before the train/test split introduces no leakage — constant-ness and missingness are properties of the predictor alone.
The missing cutoff is strictly greater-than. At the default threshold a column is dropped only when more than 95% of its rows are missing; anything at or below 95% is kept.
Deliberately minimal. Imputation, encoding, scaling, and richer feature construction are not intake's job — they belong to the generator (
gencfeatures) or the domain skill. Intake only removes columns that are dead weight for any producer.All-degenerate is an error. If every predictor is dropped, it raises
screenPredictors:noPredictorsRemain— a dataset with no usable predictor cannot proceed.Too few rows is an error. If the assembled table has fewer than 2 observations, it raises
screenPredictors:tooFewObservations— there is nothing to generate, split, or rank. The check runs on the assembled table, so it applies whether the response was a name or supplied separately.
ScreenInfo carries .Kept, .Dropped, .DroppedReasons ("constant" |
"missing>NN%"), .NumDropped, .MissingThreshold, .ConstantTolerance,
.CombinedResponse,
.ResponseVar, and .Reasoning. Report what was dropped and why — a silently
shrunk predictor set reads as data loss otherwise. Carry ScreenInfo into the
report's intake summary.
Handing off
After intake the orchestrator holds a screened predictors + response table and
the resolved response name (ScreenInfo.ResponseVar). Profile, reserve, then
split:
rng(0, "twister"); % seed the reserve+split draw once, here
Profile = profileForSplit(ScreenedTbl, ScreenInfo.ResponseVar);
[WorkingIdx, UserHeldOutIdx, ReserveInfo] = reserveHoldoutForUser( ...
ScreenedTbl, Profile.ProblemType, ScreenInfo.ResponseVar, ReserveForUser = HasNoSeparateTest);
[Splits, SplitDecision] = splitStrategy(ScreenedTbl, Profile.ProblemType, ...
ScreenInfo.ResponseVar, Subset = WorkingIdx, EvaluationStrategy = EvaluationStrategy);profileForSplit fixes the problem type and class balance. reserveHoldoutForUser
returns the WorkingIdx all downstream phases operate on. The reserved slice is a
random sample drawn across the whole dataset (stratified by class for
classification), so data arriving sorted by response or time isn't handed one end of
itself. Seed rng(0, "twister") once before this call — the same place the
assessment partitions are seeded — so the carve repeats run to run. Pass the user's
chosen fraction as HoldoutFraction = ReserveFraction; omit for the 0.2 default.
splitStrategy then
sets Splits.TrainIdx/.TestIdx over those working rows — a train/test split
under holdout, or all working rows with an empty TestIdx under
cross_validated. Generation is fit on TrainIdx only — see
feature-pool.md.
Materialize the reserved slice as a named table when a carve happened, so the user
has a real test set to feed the delivered inference script — from the original loaded
rows (their raw columns). Convention: whatever the table variable is called, the slice
is that name with a _test suffix — so for a table RawTbl:
RawTbl_test = RawTbl(UserHeldOutIdx, :); % only when UserHeldOutIdx is non-emptyThen narrate it in plain words, naming that variable, the actual fraction, and the
method actually used — e.g. "I've set aside <pct>% of RawTbl as an untouched test
set (RawTbl_test, <N> rows, <method> sampling); the other <M> rows are the working
data." Take <pct>/<N>/<M> and <method> from ReserveInfo — Method is
stratified for classification and random for regression, so say whichever ran; none
of it is a fixed number or word.
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks.
Copyright 2026 The MathWorks, Inc.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- MathWorks
- Publisher
- MathWorks (Official)
- Source
- matlab/matlab-agentic-toolkit · skills-catalog/ai-and-statistics/matlab-engineer-tabular-features · commit 2a7f215
- Licence
- BSD 2-Clause License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE.md)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by MathWorks or MathWorks.
Get it from the source
8 of this skill’s files are not mirrored here, so there is no ZIP. Get the complete skill from its source: matlab/matlab-agentic-toolkit