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

What Is The Hyperbolic Tangent Activation ANN Function?

What Is The Hyperbolic Tangent Activation ANN Function

What is a hyperbolic Tangent function? How can we use Hyperbolic Tangent Function in C++? Let’s answer these questions.

What does an activation function mean in AI?

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 . Net Input Function, here 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 another term. 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.

In C++ 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 of those as a result of the input function. Here the 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++.

What is a Hyperbolic Tangent Function or tanh()?

The hyperbolic tangent is a trigonometric function tanh() as below,

Hyperbolic functions occur in the calculations of angles and distances in hyperbolic geometry, and results in range between -1 to 1. They also occur in the solutions of many linear differential equations, cubic equations, and Laplace’s equation in Cartesian coordinates. Laplace’s equations are important in many areas of physics, including electromagnetic theory, heat transfer, fluid dynamics, and special relativity. Hyperbolic function has the unique solution to the differential equation f ′ = 1 − f2, with f (0) = 0.

In addition to all these, Hyperbolic Tangent Function can be also used as a activation function as a as below,

Let’s use his in a simple ANN example.

Is there a simple ANN C++ Example of the Hyperbolic Tangent function?

Here is a simple ANN example with Hyperbolic Tangent Function in C++ programming language

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.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?