Site icon Learn C++

What Is The SoftPlus Activation Function in C++ Neural Nets?

What Is The SoftPlus Activation Function in C++ Neural Nets

In this post, you’ll learn what the SoftPlus Activation Function in ANN is. How do we make use of the SoftPlus Activation Function? Let’s go over the specifics of how activation works. By learning activation functions and terms, it will help you to build C++ applications with the use of a C++ IDE.

What is an Activation function in Neural Networks?

An Activation Function ( phi() ) also called as transfer function, or threshold function that determines the activation value ( a = phi(sum) ) from a given value (sum) from the Net Input Function. For the Net Input Function, in our context, the sum is a sum of signals in their weights, and the activation function is a new value of this sum with a given function or conditions. In other words, the activation function is a way to transfer the sum of all weighted signals to a new activation value of that signal. There are different activation functions, mostly Linear (Identity), bipolar and logistic (sigmoid) functions are used. The activation function and its types are explained well here.

Can you create an activation function in C++?

In C++ (in general in most Programming Languages) you can create your activation function. Note that sum is the result of Net Input Function which calculates the sum of all weighted signals. We will use some as a result of the input function. Here activation value of an artificial neuron (output value) can be written by the activation function as below,

By using this sum Net Input Function Valueand phi() activation functions, let’s see some of activation functions in C++; Now Let’s see how we can use SoftPlus Function with this example formula,

What is a SoftPlus Activation Function?

The SoftPlus Activation Function is developed and published by Dugas et al in 2001. The full paper can be found here. Put simply, the Softplus function can be written as below,

f(x) = log( 1+exp(x) );

According to their paper; the basic idea of the proposed class of functions, they replace the sigmoid of a sum by a product of Softplus or sigmoid functions over each of the dimensions (using the Softplus over the convex dimensions and the sigmoid over the others). They introduced the concept that new classes of functions similar to multi-layer neural networks have those properties.

Another study published by Xavier Glorot, Antoine Bordes, Yoshua Bengio, the full paper is titled “Deep Sparse Rectifier Neural Networks” which can be found here. According to this study, in Artificial Neural Networks, while logistic sigmoid neurons are more biologically plausible than hyperbolic tangent neurons, the latter work better for training multi-layer neural networks.

According to this paper, “rectifying neurons are an even better model of biological neurons and yield equal or better performance than hyperbolic tangent networks in spite of the hard non-linearity and non-differentiability at zero, creating sparse representations with true zeros, which seem remarkably suitable for naturally sparse data. Even though they can take advantage of semi-supervised setups with extra-unlabeled data, deep rectifier networks can reach their best performance without requiring any unsupervised pre-training on purely supervised tasks with large labeled datasets. Hence, these results can be seen as a new milestone in the attempts at understanding the difficulty in training deep but purely supervised neural networks, and closing the performance gap between neural networks learned with and without unsupervised pre-training”, Ref: Deep Sparse Rectifier Neural Networks.

How can write a Softplus activation in C++?

A SoftPlus activation function in C++ can be written as below:

[crayon-66228bf94e984747371163/]

Is there a simple C++ ANN example with a SoftPlus Activation Function?

[crayon-66228bf94e992697561431/]
Exit mobile version