setL2Factor
Set L2 regularization factor of layer learnable parameter
Syntax
Description
sets the L2 regularization factor of
the parameter with the name layerUpdated
= setL2Factor(layer
,parameterName
,factor
)parameterName
in
layer
to factor
.
For built-in layers, you can set the
L2 regularization factor directly
by using the corresponding property. For example, for a
convolution2dLayer
layer, the syntax layer =
setL2Factor(layer,'Weights',factor)
is equivalent to
layer.WeightL2Factor = factor
.
sets the L2 regularization factor of
the parameter specified by the path layerUpdated
= setL2Factor(layer
,parameterPath
,factor
)parameterPath
. Use this
syntax when the layer is a networkLayer
or when the parameter is in a
dlnetwork
object in a custom layer.
sets the L2 regularization factor of
the parameter with the name netUpdated
= setL2Factor(net
,layerName
,parameterName
,factor
)parameterName
in the layer with
name layerName
for the specified dlnetwork
object.
sets the L2 regularization factor of
the parameter specified by the path netUpdated
= setL2Factor(net
,parameterPath
,factor
)parameterPath
. Use this
syntax when the parameter is in a networkLayer
or when the parameter is in a
dlnetwork
object in a custom layer.