SigmoidLayer - Sigmoid layer - MATLAB (original) (raw)

Main Content

Sigmoid layer

Since R2020b

Description

A sigmoid layer applies a sigmoid function to the input such that the output is bounded in the interval (0,1).

Tip

To use the sigmoid layer for binary or multilabel classification problems, set the loss function argument of the trainnet to"binary-crossentropy".

Creation

Syntax

Description

`layer` = sigmoidLayer creates a sigmoid layer.

`layer` = sigmoidLayer('Name',`Name`) creates a sigmoid layer and sets the optional Name property using a name-value pair argument. For example,sigmoidLayer('Name','sig1') creates a sigmoid layer with the name'sig1'. Enclose the property name in single quotes.

example

Properties

expand all

Data Types: char | string

This property is read-only.

Number of inputs to the layer, stored as 1. This layer accepts a single input only.

Data Types: double

This property is read-only.

Input names, stored as {'in'}. This layer accepts a single input only.

Data Types: cell

This property is read-only.

Number of outputs from the layer, stored as 1. This layer has a single output only.

Data Types: double

This property is read-only.

Output names, stored as {'out'}. This layer has a single output only.

Data Types: cell

Examples

collapse all

Create a sigmoid layer with the name 'sig1'.

layer = sigmoidLayer('Name', 'sig1')

layer = SigmoidLayer with properties:

Name: 'sig1'

Learnable Parameters No properties.

State Parameters No properties.

Show all properties

Algorithms

expand all

A sigmoid layer applies a sigmoid function to the input such that the output is bounded in the interval (0,1).

This operation is equivalent to

A multilabel classification problem can be thought of as a binary classification problem, where each class is considered independently of other classes as either present or not present. Solving this type of problem requires the sigmoid activation function, where for any sample xn the posterior probability of class Ck is

The value ak is the weighted sum of all the units that are connected to class k. Performing multilabel classification requires a sigmoid layer followed by a custom binary cross-entropy loss layer.

Layers in a layer array or layer graph pass data to subsequent layers as formatted dlarray objects. The format of a dlarray object is a string of characters in which each character describes the corresponding dimension of the data. The format consists of one or more of these characters:

For example, you can describe 2-D image data that is represented as a 4-D array, where the first two dimensions correspond to the spatial dimensions of the images, the third dimension corresponds to the channels of the images, and the fourth dimension corresponds to the batch dimension, as having the format "SSCB" (spatial, spatial, channel, batch).

SigmoidLayer objects apply an element-wise operation and support input data of any format. The layer does not add or remove any dimensions, so it outputs data with the same format as its input data.

Extended Capabilities

Version History

Introduced in R2020b