Artificial Intelligence TechC++C++11C++14C++17Learn C++

How To Make AI Binary/Heaviside Step Functions In C++

How To Make Binary/Heaviside Step Functions in Neural Nets

What is a Binary Step Function? Should we use Binary Step Function or Heaviside Step Function? Are Binary Step functions and Heaviside Step functions the same thing? What is a Unit Step Function? Briefly, all these terms are same, let’s explain these terms.


What is an activation function in C++ AI?

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. A Net Input Function, here, is the sum is a sum of signals in their weights, and 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.

Is it possible to create an AI 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 Value and phi() activation functions, let’s see some of activation functions in C++; Now Let’s see how we can use Binary Step Function as in this example formula,

What is a Binary Step or Heaviside Step Function?

A Binary Step Function, or Heaviside step function, or the unit step function, is a step function, named after Oliver Heaviside (1850–1925), the value of which is zero for negative arguments and one for positive arguments. That means it results 0 or 1 as a Boolean. Indicator function is described as below,

{\displaystyle H(x):=\mathbf {1} _{x>0}}

This function is an example to the general class of step functions, all of which can be represented as linear combinations of translations of this one.

Thus, Binary Step Function is a Boolean function that returns bool (1 or 0), it should be as below,

This activation function returns 1 (true) if sum>0 otherwise returns 0 (false)

Is there a C++ example of an AI Binary Step or Heaviside function?

Here is a example how to use a step function.

In addition to this indicator function, other Heaviside step function types are; a piecewise functionramp functionDirac delta function, and integral of the Dirac delta function. More details can be found on Wikipedia.

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