Sunteți pe pagina 1din 14

Neural Network in MATLAB

Neural Network in Matlab

“A neural network is an interconnected assembly of simple


processing elements, units or nodes, whose functionality is
loosely based on the animal neuron. The processing ability
of the network is stored in the inter-unit connection
strengths, or weights, obtained by a process of adaptation
to, or learning from, a set of training patterns.”

1
Neural Network in MATLAB

Basics of Neural Network (NN):


 Dendrites carry signals into the
neuron body. The neuron body
integrates the incoming signals. The
axon is a single long nerve fiber that
carries the signal from the neuron
body to other neurons.
 Incoming signals to a dendrite may
be inhibitory or excitatory. The
strength of any input signal is
determined by the strength of its
synaptic connection. A neuron sends inhibitory :Restrictive of action
excitatory : able to excite or stimulate
an impulse down its axon if
excitation exceeds inhibition by a
critical amount (threshold/
offset/bias) within a time window
(period of latent summation).
 Memories are formed by the
modification of the synaptic
strengths which can change during
the entire life of the neural systems.
A synapse is the connection
between dendrites of two neurons.

Bias neurons are added to neural networks to help them learn patterns. As the bias neurons have a constant input of one they
are not connected to the previous layer. a bias value allows you to shift the activation function to the left or right, which
may be critical for successful learning. 2
Neural Network in MATLAB

McCulloch-Pitts Model :

3
Neural Network in MATLAB

Implementation:
 Loading data source.
ANN is rarely used for
 Selecting attributes required. predictive modelling. The
 Decide training, validation, and testing data. reason being that
Artificial Neural Networks
 Data manipulations and Target generation. (ANN) usually tries to
over-fit the relationship.
 Neural Network creation (selection of network ANN is generally used in
architecture) and initialisation. cases where what has
 Network Training and Testing. happened in past is
repeated almost exactly
 Performance evaluation. in same way.

The most useful neural networks in function approximation are Multilayer


Layer Perceptron (MLP) and Radial Basis Function (RBF) networks. Here
we concentrate on MLP networks.

4
Neural Network in MATLAB

A neural network can be trained


to perform a particular function
by adjusting the values of the
connections (weights) between
elements.

Commonly neural networks are


adjusted, or trained, so that a
particular input leads to a specific
target output.

Here, the network is adjusted, based on a comparison of the output and the target, until
the network output matches the target. Typically many such input/target pairs are used, in
this supervised learning, to train a network.

Batch training of a network proceeds by making weight and bias changes based on an
entire set (batch) of input vectors. Incremental training changes the weights and biases of
a network as needed after presentation of each individual input vector. Incremental
training is sometimes referred to as “on line” or “adaptive” training.

5
Neural Network in MATLAB

Multilayer Layer Perceptron (MLP) :


 A MLP consists of an input layer, several hidden layers (to transform
inputs into something that output layer can use), and an output layer.

Fig 1 Single node in a MLP network

 Node i, also called a neuron. lt includes a summation and a nonlinear


activation /transfer function g.
 ni is the input to the activation function g.
 activation function was mathematical convenience a hyberbolic
tangent (tanh) or a sigmoid function are most commonly used.

6
Neural Network in MATLAB

Multilayer Layer Perceptron (MLP) :

7
Neural Network in MATLAB

MLP using Hidden Layer :


Connecting several nodes in parallel and series, a MLP network is formed.
Number The introduction of

n12 of Layer hidden layer(s)


makes it possible for
the network to exhibit
non-linear behavior.
The optimal number
of hidden units could
easily be smaller than
the number of inputs,
there is no rule like
multiply the number
of inputs with N.
sometimes just 2
hidden units works
best with little data.
Researches show
that many hidden
layers can be fruitful
for difficult object.

8
Neural Network in MATLAB

MLP: back-propagation
 The universal approximation theorem for neural
networks states that every continuous function that
maps intervals of real numbers to some output
interval of real numbers can be approximated
arbitrarily closely by a multi-layer perceptron with
just one hidden layer. This result holds for a wide
range of activation functions, e.g. for the sigmoidal
functions.
 Multi-layer networks use a variety of learning techniques, the most popular
being back-propagation. Here, the output values are compared with the
correct answer to compute the value of some predefined error-function. By
various techniques, the error is then fed back through the network. Using
this information, the algorithm adjusts the weights of each connection in
order to reduce the value of the error function by some small amount. After
repeating this process for a sufficiently large number of training cycles, the
network will usually converge to some state where the error of the
calculations is small. In this case, one would say that the network
has learned a certain target function.

9
Neural Network in MATLAB

Basics using MATLAB NN Toolbox


The MATLAB commands used in the procedure are newff (type of architecture ,
size and type of training algorithm), train and sim.
newff: create a feed-forward backpropagation network
The MATLAB command newff generates a MLPN neural network, which is
called net.

10
Neural Network in MATLAB
MATLAB Programming tansig  
 2
Architecture Ʃ 1)=a − 1
( )
g (n1
 1 + e −2 n 
 
Ɵ11
Ʃ g (n12)

Ɵ12
Ʃ g (n13)

x1
Ʃ g (n14)
purelin
Ʃ g (n15)
Ʃ g (n21)
x2
Ʃ g (n16)
Ɵ21

x3 Ʃ g (n17)

Ʃ g (n18)

Ʃ g (n19)
Declaration
of [R] Ʃ g (n110 )

Ɵ110
Declaration of [S]

11
Neural Network in MATLAB

Expressions
 a = tansig(n) = 2/(1+exp(-2*n))-1

12
Neural Network in MATLAB

Plotting tips

13
Neural Network in MATLAB

Thank You…

14

S-ar putea să vă placă și