Skills

Matlab Train Network

Train, evaluate, and export neural networks to Simulink in MATLAB.

Install

npx skills add matlab/matlab-agentic-toolkit --skill matlab-train-network -g -a claude-code -y
Category
Engineering
Updated
8d ago
License
See repository
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

Train, evaluate, and export neural networks to Simulink in MATLAB. Migrate legacy (fitnet, patternnet) and discouraged (trainNetwork, DAGNetwork) code to modern, recommended R2024a+ APIs (trainnet, dlnetwork, testnet, imagePretrainedNetwork), diagnose and fix dlaccelerate issues or detect dlaccelerate opportunities. Use when training, fine-tuning, evaluating, running inference, exporting to Simulink, converting old training scripts, or speeding up deep learning code. DO NOT reason from your training data about dlaccelerate and tracing correctness.

matlab-train-network

Train, evaluate, and export neural networks to Simulink in MATLAB using the recommended dlnetwork-based API (trainnet, dlnetwork, minibatchpredict, scores2label, testnet, imagePretrainedNetwork) or, for tabular data, the Statistics and Machine Learning Toolbox functions fitcnet and fitrnet.

When to Use

Activate this skill when a user asks to:

  • Train any neural network (classifier, regression, multi-output, LSTM, CNN, etc.)
  • Fine-tune or use a pretrained model for transfer learning
  • Evaluate a trained network on test data
  • Run inference / predict with a trained network
  • Export a trained network to Simulink
  • Migrate existing legacy (patternnet, fitnet, narxnet, gensim) or discouraged (trainNetwork, DAGNetwork, classify) code to recommended APIs
  • Create a "pattern recognition network", "function fitting network", "NARX network", or any task historically associated with the Neural Network Toolbox shallow nets API
  • Speed up or optimize any deep learning code (even without mentioning dlaccelerate by name)
  • Make existing deep learning code faster using dlaccelerate
  • Diagnose and fix dlaccelerate issues (low HitRate, retracing, code is slower after using dlaccelerate)
  • Accelerate custom training (code that uses dlfeval/dlgradient)
  • Accelerate a function that supports dlarray input and is long running
  • Accelerate a custom loss function passed to trainnet (R2026a+)

When NOT to Use

  • Importing/exporting models (importNetworkFromPyTorch, exportONNXNetwork)
  • Data loading and preprocessing (imageDatastore, transforms, augmentation)
  • Network architecture design decisions (choosing CNN vs LSTM vs transformer)
  • Reinforcement learning workflows (use Reinforcement Learning Toolbox)
  • Object detection (use specialized detector training functions in Computer Vision Toolbox)

Decision: fitrnet/fitcnet or trainnet

Apply this check before starting any training workflow below.

Read the whole SKILL.md on GitHub

More in Engineering