Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Train neural network for deep learning

Use `trainNetwork`

to train a deep learning network.
For image
classification and regression problems, you can train a convolutional neural network (ConvNet,
CNN), such as a directed acyclic graph (DAG) network. For sequence and time series
classification problems, you can train a long short-term memory (LSTM) network.

You can train a network on either a CPU, a GPU, multiple GPUs, or in parallel. Using
GPU, multi-GPU, and parallel options require Parallel Computing Toolbox™. To use a GPU, you
must also have a CUDA^{®} enabled NVIDIA^{®} GPU with compute capability 3.0 or higher. Specify training options including the execution environment using
`trainingOptions`

.

`trainedNet = trainNetwork(imds,layers,options)`

`trainedNet = trainNetwork(mbs,layers,options)`

`trainedNet = trainNetwork(X,Y,layers,options)`

`trainedNet = trainNetwork(C,Y,layers,options)`

`trainedNet = trainNetwork(tbl,layers,options)`

`trainedNet = trainNetwork(tbl,responseName,layers,options)`

`trainedNet = trainNetwork(tbl,responseNames,layers,options)`

```
[trainedNet,traininfo]
= trainNetwork(___)
```

trains a network for image classification problems. `trainedNet`

= trainNetwork(`imds`

,`layers`

,`options`

)`imds`

stores
the input image data, `layers`

defines the network architecture,
and `options`

defines the training options.

trains a network for image classification and regression problems.
`trainedNet`

= trainNetwork(`mbs`

,`layers`

,`options`

)`mbs`

is an augmented image source, denoising image source,
or pixel label image source, that preprocesses images for deep learning.

trains a network for image classification and regression problems.
`trainedNet`

= trainNetwork(`X`

,`Y`

,`layers`

,`options`

)`X`

contains the predictor variables and
`Y`

contains the categorical labels or numeric
responses.

trains an LSTM network for sequence-to-label and sequence-to-sequence classification
problems. `trainedNet`

= trainNetwork(`C`

,`Y`

,`layers`

,`options`

)`C`

is a cell array containing sequence or time series
predictors and `Y`

contains the categorical labels or categorical
sequences.

trains a network for classification and regression problems.
`trainedNet`

= trainNetwork(`tbl`

,`layers`

,`options`

)`tbl`

contains the predictors and the targets or response
variables. The predictors must be in the first column of `tbl`

.
For information on the targets or response variables, see the
`tbl`

argument description.

trains a network for classification and regression problems. The predictors must be
in the first column of `trainedNet`

= trainNetwork(`tbl`

,`responseName`

,`layers`

,`options`

)`tbl`

. The
`responseName`

argument specifies the response variable in
the table `tbl`

.

trains a network for regression problems. The predictors must be in the first column
of `trainedNet`

= trainNetwork(`tbl`

,`responseNames`

,`layers`

,`options`

)`tbl`

. The `responseNames`

argument
specifies the response variables in the table `tbl`

.

`[`

also returns information
on the training for any of the input arguments.`trainedNet`

,`traininfo`

]
= trainNetwork(___)

[1] M. Kudo, J. Toyama, and M. Shimbo. "Multidimensional Curve Classification Using Passing-Through Regions." *Pattern Recognition Letters*. Vol. 20, No. 11–13, pages 1103–1111.

[2] *UCI Machine
Learning Repository: Japanese Vowels Dataset*.
https://archive.ics.uci.edu/ml/datasets/Japanese+Vowels

`DAGNetwork`

| `LayerGraph`

| `SeriesNetwork`

| `classify`

| `predict`

| `trainingOptions`

Was this topic helpful?