C++C++11C++14C++17Learn C++

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

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

What is SoftPlus Activation Function in ANN? How can we use SoftPlus Activation Function? Let’s recap what the details of activation functions and explain these terms.

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:

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

close

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

About author

33+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux and some other operating systems. Dr. Yilmaz Yoru was born in 1974, Eskisehir-Turkey. He graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. One year later he started to work in the same university as an assistant. He received his MSc and PhD degrees from the same department of the same university. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics and Artificial Intelligence. He also likes the graphical 2D & 3D design and high-end innovations.
Related posts
C++ComponentsLanguage FeatureLearn C++

How To Add Shadow Effects To Your C++ Apps

C++ComponentsLanguage FeatureLearn C++

How To Make Controls Have A Glow Effect In C++?

C++Learn C++

What Is The sscanf Function In C++ And How Can I Use It?

C++C++17Introduction to C++Language FeatureLearn C++

This Is How To Use Parallel Programming in C++ Builder

en_USEnglish