matlab/matlab-agentic-toolkit / skills-catalog/ai-and-statistics/matlab-classify-tabular-data
matlab-classify-tabular-data
UnverifiedUse this skill to classify tabular data end-to-end in MATLAB — load a dataset, prepare and clean it, select promising classifiers, train them, and compare accuracies with cross-validation, holdout, or hyperparameter optimization plus statistical tests. TRIGGER when: user asks to classify tabular data, pick classifiers for a dataset, compare classifier accuracy, run cross-validation or a holdout evaluation, or find the best model with statistical uncertainty. DO NOT TRIGGER when: user has non-tabular inputs (images, sequences, time series), wants a regression model, is training a specific neural network architecture (use matlab-train-network), or wants cost-sensitive learning or an arbitrary class-prior vector (this skill only supports the built-in uniform-prior toggle for imbalanced data).
scripts/README.md
View on GitHub# Scripts — implementation rules
These rules govern any code in `scripts/` and any inline MATLAB the orchestrator generates that calls the same APIs.
## Use built-in functions, not custom code
Before writing any computation, check whether a built-in function or method already does what you need. The following must come from MATLAB:
- `kfoldLoss` / `loss` — never manually compute error rates from predictions
- `testckfold` / `testcholdout` — never implement manual paired t-tests or McNemar's test
- `predict` — never reimplement prediction logic
- `binofit` — never manually compute binomial confidence intervals
- `cvpartition` — never manually split data into folds
- `friedman` — never compute ranks manually
- `bootci` — never resample manually for bootstrap CIs
## Do not inspect or deconstruct template objects
Template objects are opaque. NEVER access their internal properties (e.g., `.ModelParams`, `.ModelParameters`, `.LearnerType`) to extract parameters. This will error — internal property names are undocumented and change between releases.
**Wrong** (causes errors like "Unrecognized property 'LearnerType'"):
```matlab
mdl = fitclinear(X, Y, 'Learner', templates{m}.ModelParams.LearnerType, 'Solver', 'lbfgs');
```
**Right** (always works):
```matlab
mdl = fit(templates{m}, X, Y);
```
`fit(template, X, Y)` is the correct way to train from a template in the holdout path. It dispatches to the correct `fitc*` function internally. Do not attempt to replicate this dispatch yourself.
## Sparse data
- Do NOT call `var` on sparse matrices — it densifies the matrix and can exhaust memory. Use `scripts/find_zero_variance_columns.m` (sparse-safe) instead.
## Training-time rules
- Do NOT use `fitcecoc` for 2-class problems.
- Do NOT impute missing values before training. Models that cannot handle NaN natively (SVM, KNN, neural network) will still be trained on the data as-is — MATLAB's `fitcsvm`, `fitcknn`, and `fitcnet` remove rows with NaN internally. Do not pre-process or offer to pre-process missing data.
- Always use the `loss` method to compute error rates — never manually compare predictions to ground truth.
## Figures
- Use plain `figure;`. Do NOT pass `'Position'` — let MATLAB use its default placement.
---
Copyright 2026 The MathWorks, Inc.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |