728x90
반응형
How to create A single Layer Perceptron?

Int this tutorial, we will create a single layer perceptron.

Int this sensor model, we well create, we will try to train our network

by using forward and backward propagation algorithms.

 

Perceptron: Algorithms that originate from neural networks.

The Perceptron receives multiple signals as inputs and outputs one signal.(Signal has 0 and 1)

 

The simplest single layer neural network model is Perceptron.

It consists of the input and output layer.

it is defined as the smallest learning unit of artificial neural network.

It is a feed forward and supervised algorithm.

 

In the feed forward neural network, inputs are transmitted unidirectionally from the input layer to the output layer.

In supervised learning, the difference between outputs and goals is considered as error.

In order to minimize this error, the weight values should be trained, ie updated appropriately.

For each sample, both inputs and outputs that need to be generated in return for

these inputs are specified on the network.

 

How to Learn a Perceptron?

 

In the Perceptron learning algorithm, an initial value is first assigned to all weights and a threshold value

and learning coefficient are determined.

Then the inputs are given and a result is obtained by multiplying the inputs by their weights and adding them

by the bias value.

If this result is greater than the specified threshold, 1 is returned, and 0 is returned if it is less.

If the calculated value and the expected value are not the same, the difference between them is taken and 

the weight value is updated acooding to this value.

This process is countinued until the desired result is achieved.

Thus, the learning is completed.

 

Activation Function

 

We need the activation function to introduce nonlinear real word features to artificial neural networks.

Basically, in a simple neural network, x is defined as inputs, w weights, and we apply f(x), or activation,

to the value transferred to the output of the network.

Then this will be the final exit or the entrance to another layer.

Activation functions allow us to bring our outputs to a certain range,

The most well-known activation functions are sigmoid, tanh, relu, etc.

 

FeedForward Propagation

 

Step 1: We multiply the weight values by the input values and then add them.

y = x1 * w1 + x2 * w2

 

Step 2: To find the value of a, we put the y value into the sigmoid function.
Sigmoid function is one of the activation functions.

a = sigmoid(y)

sigmoid = 1 / (1 + 2 ^ -y)

 

Step 3: The value a we found in the second step also belong to the y_heade value.
At this stage we will find the error value.

y_head = a

error = 1 /2(y - y_head)^2

 

Backward Propagation

 

The back propagation algorithm is more difficult to understand than the forward propagation algorithm.

In this backpropagation algorithm, we are trying to update the weight values of our artificial neural network.

To update these weight values, we get derivative our output functions.

We use the partial derivative method for this.

If you do not about derivatives, you can get information about derivatives by using this link.

 

Step 1: To find the smallest change in the value of w1, we need to find the derivative of the error function with

respect to w1. But since our error function does not contain the value of w1, we need to derive the part.

 

Step 2: To find the derivative of the error respect to w1, we must mutiply the values.

 

Step 3: To find the smallest change in the value of w2, we need to find the derivative of the error function with respect to w2. But since our function does not contain the value of w2, we need to derive the part.

 

Step 4: To find derivative of the error respect to w2, we must multiply the values.

 

Step 5: To find the new values of the weights, we must subtract the ne found weight value from old weight value.

w1 = old_w1 - derivative_w1

w2 = old_w2 - derivative_w2

 

In the next tutorial we will see how to create a single layer neural network with coding.(python).

 

How to Create Single Layer Neural Network with Python? :: Rogue

 

vodkasoda.tistory.com

 

728x90
반응형

'Deep Learning' 카테고리의 다른 글

How To Build An Artificial Neural Network With Python  (0) 2022.09.12
How to Create Single Layer Neural Network with Python?  (0) 2022.09.12
Linear Functions  (0) 2022.09.11
CNN  (0) 2022.09.08
Count Objects in Image using Python  (0) 2022.09.06

+ Recent posts