Thinking according to the situation and environment is called Intelligence. We can say just thinking, for example think of a cat. How it can identify a cup of milk? It should be white or almost white, liquid or looks like liquid especially it should smells like milk. But is that necessary that all characteristics of milk should be there so that cat can identify? No! Imagine a cat, what it will do when a cup of milk was there in floor? It will go near to the cup then and it will smell then it will taste it once it get concluded that the cup is filled with milk then it will start drinking it. So you can see a logical flow in this process. If we can able to make it as an algorithm, we are ready to write an AI. Before starting about ANN we will get a simple example unlike the cat’s sniffing process. Because the cat’s process has many sub process to consider. So here we go.
See the matrix or figure or image whatever your maid interprets about it, what do you think? Is it looks like a “zero” (If not please assume it as a zero!!). Let me explain why I am telling this as zero, my mind already seen zero before which will be like oval or circle in shape or like a ring. So the image almost look like the same. So here it is I can conclude it as zero.
Technically this assumption may be done like the images which are shown above. So why can’t we think this in that way for developing algorithms. As like the images we will keep matrix or a grid or pixels whatever it is. Make everything as matrix so we can call that as two dimensional array. So assume = and if a particular element in the array has filled with zero then assume the weight of the element as so that the image’s each matrix will be having weight. Therefore the total assumption will be as equation-1. And these n number of input and a processing unit and output is called as The Perceptron.
…………………Equation 1
So will be the Activation according to assumption value. We can always have a standard format for the arithmetic mean. Summation of series which will be like Equation-2
…………………Equation 2
This can be implemented in programming language as shown in below
double a = 0; for (int i=0; i<n; i++) { a += x[i] * w[i]; }
So how can we calculate this with network? We can do this by organizing the neurons into a design called a feed forward network. This is what a very simple feed forward network looks like:
This will be like chain where each input is connected to every neuron which is in the hidden layer and then each hidden layer will have neurons and those outputs are connected to every neuron in the next layer. So we can have N number of hidden layers within a feed forward network. Similarly there can be any number of neurons in each layer according to the case which we are going to do. These all will be like our own brain’s neurons which are making us to think.
//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
(adsbygoogle = window.adsbygoogle || []).push({});
Once the neural network has been created it needs to be trained. So here we can get the Summation in codes which has random weights. Since the matrix value has weight and input value each element will have different value which mean each element of the matrix will be like 2*x or 1*x or 0*x. so summation value will be unique for every character or image or symbol or whatever it is. According to that the weight of each element assumption value will change. By giving verification classes which are like reference values (Training sets) we can come to conclude that the symbol is zero or whatever it is. From this we can understand a thing clearly that by increasing training sets accuracy of prediction. Let’s take our example zero what if the number of matrix increases which it should be easy to find assumptions. Consider the figure below.
Is this logic only for images or symbols like this? No. All kind of physics phenomenon which ever human can guess by his intelligence. For example assume voice, how a human recognize a voice of particular parson? Human have heard the voice of a person and saved the pattern of his voice in his mind (not a speech but voice pattern) then he is hearing a voice and comparing those voice pattern with what he heard before. If that voice matches with any of his voice pattern then he will conclude that the voice is particular person’s voice. That’s it.
Like how images and symbols are having a pattern, sound is also having a pattern called frequency variation patterns. What we have to do is to find the assumptions value for that. So we have to go for an equation which calculates the pattern and gives a single value. This can be done by doing some research work on a subset of modal phenomena called cymatics. Here is some examples where mathematical explanation of sound.
So we came to know that we can able to make set of pattern values for all physical phenomenon. Now all we need to do is make everything into classes of patterns (Training sets and test sets). Now create a class in any programming language what you know. We have to write a class like accepting the sample values from real time entity and keeps with it. So here is an example class
class Perceptron { float[] weights; }
The processing part will be the perceptron. Then the perceptron function which is inside the class should be like this
Perceptron(int n) { weights = new float[n]; for (int i = 0; i < weights.length; i++) { weights[i] = random(-1,1); } }
Then the feed forward function to find the pattern from that will be like this
int feedforward(float[] inputs) { float sum = 0; for (int i = 0; i < weights.length; i++) { sum += inputs[i]*weights[i]; } return activate(sum); }
Then function to find whether the function is activating or not is
int activate(float sum) { if (sum > 0) return 1; else return -1; }
Then this is a function to Train the network against known data. But always we have to worry about errors. If we can able to rectify errors we can get more accurate answers right? So what is error? difference between actual desired output what we have expected is always called error. so this can be written like this
ERROR = DESIRED OUTPUT – GUESS OUTPUT
so net weight can be effected by the error so we have to consider errors to so the net weight can be calculated by
NEW WEIGHT = WEIGHT + ERROR * INPUT
so we know what is weight, error and most obviously input, make it code !!
void train(float[] inputs, int desired) { int guess = feedforward(inputs); float error = desired - guess; for (int i = 0; i < weights.length; i++) { weights[i] += c * error * inputs[i]; } }
So over all coding part will be like this
class Perceptron { float[] weights; float c = 0.01; Perceptron(int n) { weights = new float[n]; for (int i = 0; i < weights.length; i++) { weights[i] = random(-1,1); } } int feedforward(float[] inputs) { float sum = 0; for (int i = 0; i < weights.length; i++) { sum += inputs[i]*weights[i]; } return activate(sum); } int activate(float sum) { if (sum > 0) return 1; else return -1; } void train(float[] inputs, int desired) { int guess = feedforward(inputs); float error = desired - guess; for (int i = 0; i < weights.length; i++) { weights[i] += c * error * inputs[i]; } } }
So by doing this algorithm will let system to learn which can be explained like in figure
So all are about logics just developers need to make this possible to develop a real application. Just for an example we all have a smart phone and it has camera in it. Idea is to capture an image of real world and let it recognize the image by doing our ANN implementation and convert that in to words. For example if we capture a dog then our phone should say “DOG”. Possible rite? It will be useful for visually challenged people and even. Let’s start with it.
Soon I will post my first AI application here. Keep supporting.
Certified Cloud Automation Architect and DevSecOps expert, skilled in optimizing IT workflows with Six Sigma and Value Stream Management. Proficient in both technical and leadership roles, I deliver robust solutions and lead teams to success.