Artificial Intelligence TechC++Learn C++

AI Techs :: Array Based Simple Artificial Neuron Model in C++

Do you want to develop your artificial intelligence application from the scratch? Want to learn how you can develop a simple artificial neuron model in C++? In this post, we will explain with a very simple artificial neuron example. We have released A Simple Artificial Neuron Model in C++ and Very Simple Artificial Neural Network (ANN) Example in C++ before. We highly recommend reading them if you are new to AI technology.

A Simple ANN Model

We have presented this Simple AI neuron before, let’s remember. A Minimum Artificial Neuron has an activation value (a), an activation function ( phi() ) and weighted (w) input net links. So it has one activation value, one activation function and one or more weights depend on the number of its input nets.

This is a very simple artificial neural network in AI technolgy . Now go with this example and improve our neuron models and lets create an artificial neuron model by using arrays.

Array Based Artificial Neuron Model in C++

This is another simple neuron example with arrays. This example is also good for C applications on IoTs. If you have a constant network and you know the trained data values, this model may be easy to check activation of neurons. Arrays are easy to allocate memory and easy to use on static neural networks.

Let’s define number of neurons, if it varies in your application use int,

We should have an activation function, in other term transfer function phi(), linear, sigmoid, etc.. Let’s define very simple linear transfer function.

First, we should define & initialize activity of neurons,

Next, we should define & initialize weights of neural links,

Finally we can calculate new activity values of output neuron by using our activation function as below,

Thus, output activation value of neuron 2 can be written as below,

Here is the full example combined together,

This is a good example and friendly with C and C++ codes, that means you can use it on IoTs with MicroC, Ardunio C, Dev C++ or you can go for GNU C/C++, Visual C++, or C++ Builder professionally.

Get started building powerful apps with C++Builder!

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.


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

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++ComponentsDatabaseIntroduction to C++Language FeatureLearn C++

Get To Know The Powerful C++ Data Bindings In Windows Apps

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

How to Create a New Windows FMX Static Library In C++

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

How To Use C++ front() And back() Methods Of Vectors

C++Generic ProgrammingIntroduction to C++Language FeatureLearn C++

5 Things You Need To Know About Optimization In C++ Builder

it_ITItalian