Main Content

These properties define the basic features of a network. Neural Network Subobject Properties describes properties that define network details.

Here are the general properties of neural networks.

This property consists of a string defining the network name.
Network creation functions, such as `feedforwardnet`

,
define this appropriately. But it can be set to any string as desired.

This property provides a place for users to add custom information
to a network object. Only one field is predefined. It contains a *secret* message
to all Deep Learning Toolbox™ users:

net.userdata.note

These properties determine the number of network subobjects (which include inputs, layers, outputs, targets, biases, and weights), and how they are connected.

This property defines the number of inputs a network receives. It can be set to 0 or a positive integer.

**Clarification. **The number of network inputs and the size of a network input
are *not* the same thing. The number of inputs
defines how many sets of vectors the network receives as input. The
size of each input (i.e., the number of elements in each input vector)
is determined by the input size (`net.inputs{i}.size`

).

Most networks have only one input, whose size is determined by the problem.

**Side Effects. **Any change to this property results in a change in the size
of the matrix defining connections to layers from inputs, (`net.inputConnect`

)
and the size of the cell array of input subobjects (`net.inputs`

).

This property defines the number of layers a network has. It can be set to 0 or a positive integer.

**Side Effects. **Any change to this property changes the size of each of these
Boolean matrices that define connections to and from layers:

net.biasConnect net.inputConnect net.layerConnect net.outputConnect

and changes the size of each cell array of subobject structures whose size depends on the number of layers:

net.biases net.inputWeights net.layerWeights net.outputs

and also changes the size of each of the network's adjustable parameter's properties:

net.IW net.LW net.b

This property defines which layers have biases. It can be set
to any *N*-by-1 matrix of Boolean values, where *N _{l}* is
the number of network layers (

`net.numLayers`

). The
presence (or absence) of a bias to the net.biasConnect(i)

**Side Effects. **Any change to this property alters the presence or absence of
structures in the cell array of biases (`net.biases`

)
and, in the presence or absence of vectors in the cell array, of bias
vectors (`net.b`

).

This property defines which layers have weights coming from inputs.

It can be set to any *N _{l}* ×

`net.numLayers`

), and `net.numInputs`

). The
presence (or absence) of a weight going to the `net.inputConnect(i,j)`

.**Side Effects. **Any change to this property alters the presence or absence of
structures in the cell array of input weight subobjects (`net.inputWeights`

)
and the presence or absence of matrices in the cell array of input
weight matrices (`net.IW`

).

This property defines which layers have weights coming from
other layers. It can be set to any *N _{l}* ×

`net.numLayers`

). The
presence (or absence) of a weight going to the net.layerConnect(i,j)

**Side Effects. **Any change to this property alters the presence or absence of
structures in the cell array of layer weight subobjects (`net.layerWeights`

)
and the presence or absence of matrices in the cell array of layer
weight matrices (`net.LW`

).

This property defines which layers generate network outputs.
It can be set to any 1 × *N _{l}* matrix
of Boolean values, where

`net.numLayers`

). The
presence (or absence) of a network output from the `net.outputConnect(i)`

.**Side Effects. **Any change to this property alters the number of network outputs
(`net.numOutputs`

) and the presence or absence of
structures in the cell array of output subobjects (`net.outputs`

).

This property indicates how many outputs the network has. It
is always equal to the number of 1s in `net.outputConnect`

.

This property indicates the number of time steps of past inputs that must be supplied to simulate the network. It is always set to the maximum delay value associated with any of the network's input weights:

numInputDelays = 0; for i=1:net.numLayers for j=1:net.numInputs if net.inputConnect(i,j) numInputDelays = max( ... [numInputDelays net.inputWeights{i,j}.delays]); end end end

This property indicates the number of time steps of past layer outputs that must be supplied to simulate the network. It is always set to the maximum delay value associated with any of the network's layer weights:

numLayerDelays = 0; for i=1:net.numLayers for j=1:net.numLayers if net.layerConnect(i,j) numLayerDelays = max( ... [numLayerDelays net.layerWeights{i,j}.delays]); end end end

This property indicates the number of weight and bias values in the network. It is the sum of the number of elements in the matrices stored in the two cell arrays:

net.IW new.b

These properties consist of cell arrays of structures that define each of the network's inputs, layers, outputs, targets, biases, and weights.

The properties for each kind of subobject are described in Neural Network Subobject Properties.

This property holds structures of properties for each of the
network's inputs. It is always an *N _{i}* ×
1 cell array of input structures, where

`net.numInputs`

).The structure defining the properties of the *i*th
network input is located at

net.inputs{i}

If a neural network has only one input, then you can access `net.inputs{1}`

without
the cell array notation as follows:

net.input

**Input Properties. **See Inputs for descriptions of input properties.

This property holds structures of properties for each of the
network's layers. It is always an *N _{l}* ×
1 cell array of layer structures, where

`net.numLayers`

).The structure defining the properties of the *i*th
layer is located at `net.layers{i}`

.

**Layer Properties. **See Layers for descriptions of layer properties.

This property holds structures of properties for each of the
network's outputs. It is always a 1 × *N _{l}* cell
array, where

`net.numOutputs`

).The structure defining the properties of the output from the *i*th
layer (or a null matrix `[]`

) is located at `net.outputs{i}`

if `net.outputConnect(i)`

is
1 (or 0).

If a neural network has only one output at layer `i`

,
then you can access `net.outputs{i}`

without the
cell array notation as follows:

net.output

**Output Properties. **See Outputs for descriptions of output properties.

This property holds structures of properties for each of the
network's biases. It is always an *N _{l}* ×
1 cell array, where

`net.numLayers`

).The structure defining the properties of the bias associated
with the *i*th layer (or a null matrix `[]`

)
is located at `net.biases{i}`

if `net.biasConnect(i)`

is
1 (or 0).

**Bias Properties. **See Biases for descriptions of bias properties.

This property holds structures of properties for each of the
network's input weights. It is always an *N _{l}* ×

`net.numLayers`

), and `net.numInputs`

).The structure defining the properties of the weight going to
the *i*th layer from the *j*th input
(or a null matrix `[]`

) is located at `net.inputWeights{i,j}`

if `net.inputConnect(i,j)`

is
1 (or 0).

**Input Weight Properties. **See Input Weights for descriptions of input weight properties.

This property holds structures of properties for each of the
network's layer weights. It is always an *N _{l}* ×

`net.numLayers`

).The structure defining the properties of the weight going to
the *i*th layer from the *j*th layer
(or a null matrix `[]`

) is located at `net.layerWeights{i,j}`

if `net.layerConnect(i,j)`

is
1 (or 0).

**Layer Weight Properties. **See Layer Weights* *for descriptions of layer
weight properties.

These properties define the algorithms to use when a network is to adapt, is to be initialized, is to have its performance measured, or is to be trained.

This property defines the function to be used when the network
adapts. It can be set to the name of any network adapt function. The
network adapt function is used to perform adaption whenever `adapt`

is called.

[net,Y,E,Pf,Af] = adapt(NET,P,T,Pi,Ai)

For a list of functions, type `help nntrain`

.

**Side Effects. **Whenever this property is altered, the network's adaption parameters
(`net.adaptParam`

) are set to contain the parameters
and default values of the new function.

This property defines the parameters and values of the current
adapt function. Call `help`

on the current adapt
function to get a description of what each field means:

help(net.adaptFcn)

This property defines the derivative function to be used to calculate error gradients and Jacobians when the network is trained using a supervised algorithm, such as backpropagation. You can set this property to the name of any derivative function.

For a list of functions, type `help nnderivative`

.

This property defines the data division function to be used when the network is trained using a supervised algorithm, such as backpropagation. You can set this property to the name of a division function.

For a list of functions, type `help nndivision`

.

**Side Effects. **Whenever this property is altered, the network's adaption parameters
(`net.divideParam`

) are set to contain the parameters
and default values of the new function.

This property defines the parameters and values of the current data-division function. To get a description of what each field means, type the following command:

help(net.divideFcn)

This property defines the target data dimensions which to divide
up when the data division function is called. Its default value is `'sample'`

for
static networks and `'time'`

for dynamic networks.
It may also be set to `'sampletime'`

to divide targets
by both sample and timestep, `'all'`

to divide up
targets by every scalar value, or `'none'`

to not
divide up data at all (in which case all data is used for training,
none for validation or testing).

This property defines the function used to initialize the network's
weight matrices and bias vectors. .
The initialization function is used to initialize the network whenever `init`

is called:

net = init(net)

**Side Effects. **Whenever this property is altered, the network's initialization
parameters (`net.initParam`

) are set to contain the
parameters and default values of the new function.

This property defines the parameters and values of the current
initialization function. Call `help`

on the current
initialization function to get a description of what each field means:

help(net.initFcn)

This property defines the function
used to measure the network’s performance. The performance
function is used to calculate network performance during training
whenever `train`

is called.

[net,tr] = train(NET,P,T,Pi,Ai)

For a list of functions, type `help nnperformance`

.

**Side Effects. **Whenever this property is altered, the network's performance
parameters (`net.performParam`

) are set to contain
the parameters and default values of the new function.

This property defines the parameters and values of the current
performance function. Call `help`

on the current
performance function to get a description of what each field means:

help(net.performFcn)

This property consists of a row cell array of strings, defining
the plot functions associated with a network. The neural network training
window, which is opened by the `train`

function,
shows a button for each plotting function. Click the button during
or after training to open the desired plot.

This property consists of a row cell array of structures, defining
the parameters and values of each plot function in `net.plotFcns`

.
Call `help`

on the each plot function to get a description
of what each field means:

help(net.plotFcns{i})

This property defines the function used to train the network.
It can be set to the name of any of the training functions, which
is used to train the network whenever `train`

is
called.

[net,tr] = train(NET,P,T,Pi,Ai)

For a list of functions, type `help nntrain`

.

**Side Effects. **Whenever this property is altered, the network's training parameters
(`net.trainParam`

) are set to contain the parameters
and default values of the new function.

This property defines the parameters and values of the current
training function. Call `help`

on the current training
function to get a description of what each field means:

help(net.trainFcn)

These properties define the network's adjustable parameters: its weight matrices and bias vectors.

This property defines the weight matrices of weights going to
layers from network inputs. It is always an *N _{l}* ×

`net.numLayers`

), and `net.numInputs`

).The weight matrix for the weight going to the *i*th
layer from the *j*th input (or a null matrix `[]`

)
is located at `net.IW{i,j}`

if `net.inputConnect(i,j)`

is `1`

(or `0`

).

The weight matrix has as many rows as the size of the layer
it goes to (`net.layers{i}.size`

). It has as many
columns as the product of the input size with the number of delays
associated with the weight:

net.inputs{j}.size * length(net.inputWeights{i,j}.delays)

These dimensions can also be obtained from the input weight properties:

net.inputWeights{i,j}.size

This property defines the weight matrices of weights going to
layers from other layers. It is always an *N _{l}* ×

`net.numLayers`

).The weight matrix for the weight going to the *i*th
layer from the *j*th layer (or a null matrix `[]`

)
is located at `net.LW{i,j}`

if `net.layerConnect(i,j)`

is
1 (or 0).

The weight matrix has as many rows as the size of the layer
it goes to (`net.layers{i}.size`

). It has as many
columns as the product of the size of the layer it comes from with
the number of delays associated with the weight:

net.layers{j}.size * length(net.layerWeights{i,j}.delays)

These dimensions can also be obtained from the layer weight properties:

net.layerWeights{i,j}.size

This property defines the **bias vectors for each layer with a bias. It
is always an ***N _{l }* ×
1 cell array, where

`net.numLayers`

).The bias vector for the *i*th layer (or a null
matrix `[]`

) is located at `net.b{i}`

if `net.biasConnect(i)`

is
1 (or 0).

The number of elements in the bias vector is always equal to
the size of the layer it is associated with (`net.layers{i}.size`

).

This dimension can also be obtained from the bias properties:

net.biases{i}.size