NNEE561 jaber

download NNEE561 jaber

of 19

Transcript of NNEE561 jaber

  • 7/27/2019 NNEE561 jaber

    1/19

    ARTIFICIAL NEURAL

    NETWORKS

  • 7/27/2019 NNEE561 jaber

    2/19

    6.1 Introduction

    Neural networks, fuzzy logic and genetic algorithms are exciting technologies

    in the field of artificial intelligence. Artificial neural networks (ANN) have

    revolutionized the way researchers solve many complex and real-world problems

    in engineering, science, economics, and finance. The motivation for the

    development of the neural network technology stemmed from the desire to develop

    an artificial system that could perform "intelligent" tasks similar to those

    performed by the human brain [20,22].

    6.1.1 Structure of One Neuron

    The science of the artificial neural networks is based on a collection of

    simple processing units (neuron) that are massively interconnected in order to

    produce meaningful behavior. In order to understand the structure of artificial

    networks, the basic elements of the neuron should be understood.

    Neurons are the fundamental elements in the central nervous system. The diagram

    below Figure 6.1 shows the components of a neuron.

    Figure 6.1: The diagram shows the basic elements of a neuron

    A neuron is made up of three main parts - dendrites, cell body and axon. The

    dendrites receive the signals coming from the neighboring neurons.

    They send these signals to the body of the cell. The cell body contains the nucleus

    of the neuron. If the sum of the received signals is greater than the threshold value,

  • 7/27/2019 NNEE561 jaber

    3/19

    the neuron fires by sending an electrical pulse along the axon to the next neuron.

    The point of contact between an axon of one cell and dendrites of another cell is

    called a synapse.

    The following model (Figure 6.2) is based on the components of the biological

    neuron. The inputs X0-X3 represent the dendrites. Each input is multiplied by

    weights W0-W3. The weight W corresponds to the strength of synapse. The cell

    body is represented by the summation and the transfer function, and the output of

    the neuron model, Y is a function, F of the summation of the input signals, and the

    neuro output represents the signal on the axon [22].

    Figure 6.2: Diagram of neuron model

    6.1.2 Neural networks in Process Modeling and Control

    Control of non-linear systems is a major application area for neural network

    that have been applied very successfully in the identification and control of

    dynamic systems. This control method derives the advantage from the fact that it is

    not using any mathematical model of the system. Instead they use input output

    relations. There are typically two steps involved when using neural networks forcontrol: -

    1- system identification. 2- control design.

    F

    0w

    1w

    2w

    0X

    1X

    2X

    Y

    FX

    Y=F( WX )W

  • 7/27/2019 NNEE561 jaber

    4/19

    In the system identification stage, a neural network model of the plant must be

    developed. In the control design stage, the developed model is used to design (or

    train) the controller[22].

    6.2 Advantages of ANNs

    1- The main advantage of neural networks is that it is possibe to be trained to

    perform a particular function by adjusting the values of connections (weights)

    between elements. For example, if it is required to train a neural model to

    approximate a specific function, the weights that multiply each input signal would

    be updated until the output from the neuron is similar to the function.

    2- Neural networks are composed of elements operating in parallel. Parallel

    processing allows increased speed of calculation compared to slower sequential

    processing.

    Figure 6.3: Diagram shows the parallelism of neural networks

    3- Artificial neural networks have high memory. It corresponds to the weights in

    the neurons. Neural networks can be trained offline and then transferred into a

    process where adaptive online learning takes place.

    In our case, a neural network controller can be trained to control non-linear

    plant offline in the simulink environment. After that, the network weights are set.

    Direction of signals

    OutputInput

  • 7/27/2019 NNEE561 jaber

    5/19

    The ANN is placed in a feedback loop with the actual process. The network will

    adapt the weights to improve performance while it controls the plant.

  • 7/27/2019 NNEE561 jaber

    6/19

    6.3 Training Neural NetworksNetworks of these artificial neurons do not have a fraction of the power of the

    human brain, but they can be trained to perform useful functions. As in nature, the

    network function is determined largely by the connections between elements.

    Neural network can be trained to perform a particular function by adjusting the

    values of the connections (weights) between elements.

    Commonly neuralnetworks are adjusted, or trained, so that a particular input

    leads to a specific target output. Such a situation is shown below. The network is

    adjusted, based on a comparison of the output and the target, until the network

    output matches the target [22,23].

    Figure 6.4: Training neural network

    6.3.1 Training Styles

    In this section, two different styles of training are described.

    In batch trainingthe weights and biases are only updated after all of the inputs are

    presented.

    In incremental trainingthe weights and biases of the network are updated each

    time input is presented to the network. Incremental training is sometimes referred

    to as online or adaptive training.

  • 7/27/2019 NNEE561 jaber

    7/19

    6.3.2 Learning Rules

    Learning rules can be defined as a procedure for modifying the weights and

    biases of a network. (This procedure may also be referred to as a trainingalgorithm). The learning rules are applied to train the network to perform some

    particular task.

    There are general ly four steps in the train ing process: -

    1 - Assemble the training data.

    2 - Create the network object.

    3 - Train the network.

    4 - Simulate the network response to new inputs.

    There are many types of neural network learning rules. They fall into three

    broad categories: supervised learning, reinforced learning and unsupervised

    learning.

    In Supervised Learning, the learning rule is provided with a set of examples (the

    training set) of proper network behavior:

    {p1 , t1 } , { p2 , t2 } , { p3 , t3} , { pq , tq },

    where pq is an input to the network and tq is the corresponding correct (target)

    output. As the inputs are applied to the network, the network outputs are compared

    to the targets. The learning rule is then used to adjust the weights and biases of the

    network in order to move the network outputs closer to the targets.

    Reinforced Learning is similar to supervised learning, except that, instead of

    being provided with the correct output for each network input, the algorithm is

    only given a grade. The grade (or score) is a measure of the network performance

    over some sequence of inputs. This type of learning is currently much less

    common than supervised learning.

  • 7/27/2019 NNEE561 jaber

    8/19

    In Unsupervised Learning, the weights are modified in response to network

    inputs only. There are no target outputs available [20,21].

    6.4 Neural Network Structures

    There are three main types of ANN structure, single-layer feedforward

    network, multi-layer feedforward network and recurrent networks [20,22].

    1- Single-layer Feedforward Network

    The most common type of single layer feedforward network is the perceptron. The

    details of the perceptron are shown Figure 6.5.

    Figure 6.6: Diagram of the perceptron model

    Inputs to perceptron are individually weighed and then summed. The perceptron

    computes the output as a function F of the sum. The activation function, F is

    needed to introduce non-linearities into the network. This makes multi-layer

    networks powerful in representing non-linear functions. Once the weights are

    adjusted, the feed-forward process is repeated. The weights are adapted until the

    error between the target and actual output is low. The approximation of the

    function improves as the error decreases.

    2Multi-layer Feedforward Network

    In multilayerfeedforward networks the direction of signals is from input to output.

    There is no feedback in the layers. Feedforward neural networks (FNNs) are

  • 7/27/2019 NNEE561 jaber

    9/19

    composed of layers of neurons, in which the input layer of neurons are connected

    to the output layer of neurons. The diagram below (Figure 6.6) shows a three-

    layered feedforward network.

    Figure 6.6: Diagram of a feedforward neural network

    Increasing the number of neurons in the hidden layer or adding more hidden layers

    to the network allows it to deal with more complex functions. The weights in

    multi-layer perceptrons MLPs are updated using backprobagation learning . The

    weights are adjusted until the actual output of the MLP moves closer to the desired

    output.

    3- Recurrent Network

    Recurrent networks (Figure 6.7) have at least one feedback loop. This means an

    output of a layer feeds back to any proceeding layer.

    Input

    F

    F

    F

    F

    Hidden Layer Output Layer

    Z

    Z

    Z

    Output

  • 7/27/2019 NNEE561 jaber

    10/19

    Figure 6.7: Diagram of a recurrent neural network

    This procedure gives the network a partial memory due to the hidden layer receives

    data at time t but also at time t-1. This makes recurrent networks powerful in

    approximating functions depending on time.

    6.5 Function Approximation

    Backpropagation can train multi-layer feedforward networks with

    differentiable transfer functions to perform function approximation. The two-layer

    sigmoid/linear network can represent any functional relationship between inputs

    and outputs if the sigmoid layer has enough

    neurons. There are several different backpropagation training algorithms. They

    have a variety of different computations [18,20,21].

    Problem

    It is desired to design a 2-layer feedforward NN to approximate the non-linear

    function y=f(x), The hidden layer with 10 neurons has hyperbolic activation

    function, and the output layer is linear and training the network so that mean

    square error < = 0.005.

    x -1: 0.1: 1

    Y=

    f(x)

    -0.960 , -0.577 , -0.073 , 0.377 , 0.641 , 0.660 , 0.461 ,

    , -0.201 , -0.434 , -0.500 , -0.393 , -0.165 , 0.099 ,

    0.307 , 0.396 , 0.345 , 0.182 , -0.031 , -0.219, -0.320

    The performance of the various algorithms can affect the accuracy required for the

    approximation. This is demonstrated in the Figure 6.9, and the following table

    summarizes the results of training the network using five different training

    algorithms [Appendix B]. The fastest algorithm for this problem is the

  • 7/27/2019 NNEE561 jaber

    11/19

    -1 -0.5 0 0.5 1 1.5-1

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    0.6

    0.8

    traingd

    traingdx

    traincgp

    trainoss

    trainlm

    actual plant

    Levenberg-Marquardt Backpropagation (LMBP) algorithm, and the approximation

    must be very accurate [Appendix A]. This is the type of problem for which the LM

    algorithm is best-suited function approximation problem. In many cases, trainlm

    function is able to obtain lower mean square errors than any of the other algorithms

    tested.

    Figure 6.8: Backpropagation training algorithms

  • 7/27/2019 NNEE561 jaber

    12/19

    Table 6.1: Summarizes the results of training algorithms

    Algorithm Iteration MSE Goal

    triangd

    Batch Gradient Descent500 0.06159

    Performance goal

    was not met

    traingdx

    Variable Learning Rate

    Backpropagation

    95 0.00478Performance

    goal met

    traincgp

    Conjugate Gradient with

    Powell/Beale Restarts

    12 0.00497Performance

    goal met

    trainoss

    One-Step Secant16 0.00471

    Performance

    goal met

    trainlm

    Levenberg-Marquardt3 0.00159

    Performance

    goal met

    6.6 Neural Network Based Control

    Before the actual neuro-controller is developed in Matlab, the main types of

    neuro-control are discussed. The four types of neural network control methods that

    have been studied are supervised control, model reference control, direct inverse

    control and internal model control [18,24].

    1 - Supervised Control

    It is possible to teach a neural network the correct actions by using an existing

    controller. This type of control is called supervised learning. But why would we

  • 7/27/2019 NNEE561 jaber

    13/19

    want to copy an existing controller that already does the job? Most traditional

    controllers (feedback linearization) are based around an operating point. This

    means that the controller can operate correctly if the plant operates around a certain

    point. These controllers will fail if there is any sort of uncertainty or change in

    unknown plant. The advantages of neuro-control are if an uncertainty in the plant

    occurs, the ANN will be able to adapt its parameters and maintain controlling the

    plant when other robust controllers would fail.

    In supervised control, a teacher provides the correct actions for the neural

    network to learn (Figure 6.9). In offline training the targets are provided by an

    existing controller, the neural network adjusts its weights until the output from the

    ANN is similar to the controller. When the neural network is trained, it is placed in

    the feedback loop. Because the ANN is trained using the existing controller targets,

    it should be able to control the process.

    OutputInput

    Update

    weights

    Error

    Process

    ANN

    Controller

    +

    +

    -

    -

  • 7/27/2019 NNEE561 jaber

    14/19

    Figure 6.9: Supervised learning using an existing controller

    At this stage, there is an ANN, which controls the process similar to theexisting controller. The real advantage of neuro-control is the ability to be adaptive

    online (Figure 6.10). An error signal (desired signal real output signal) is

    calculated and used to adjust the weights online. If a large disturbance uncertainty

    occurs in the process - the large error signal is feedback into the ANN and this

    adjusts the weights so the system remains stable.

    Figure 6.10: Adaptive neural control

    OutputInput Process

    Error signal is used to

    adjust the weights

    Desired

    responce

    +

    +

    -

    -

  • 7/27/2019 NNEE561 jaber

    15/19

    2 - Model Reference Control

    In the diagram above (Figure 6.10), the error signal is generated by subtracting

    the output signal from the desired system response. In model reference control the

    desired closed loop response is specified through a stable reference model (Figure

    6.11). The control system attempts to make the process output similar to the

    reference model output.

    Figure 6.11: Model reference control

    3 - Direct Inverse Control

    The next type of control technique studied is direct inverse control. The

    advantage of using inverse control over supervised control is that inverse control

    does not require an existing controller in training. Inverse control utilizes the

    inverse of the system model. The diagram below (Figure 6.12) is a simple example

    of direct inverse control. A neural network is trained to model the inverse of the

    process. When the inverse model (controller) is cascaded with the process the

    output of the combined system will be equal to the setpoint. Notice that this ideal

    control performance is achieved without feedback. The inverse non-linearities in

    the controller cancel out the non-linearities in the process. For the non-linearities to

    be effectively cancelled, the inverse model must be very accurate.

    1elmodc )s(G)s(G

    ANN Process

    ReferenceModel

    Output

    +

    -

    +-

    Input

  • 7/27/2019 NNEE561 jaber

    16/19

    Figure 6.12: Direct inverse control

    Inverse modeling is used to generate the inverse of the process. The system

    output is used as an input to the network. The ANN output is compared with the

    training signal (the system input) and this error signal is used to train the network

    (Figure 6.13).

    Figure 6.13: Inverse modeling of a process

    4 - Internal Model Control (IMC)

    Internal model control is based on direct inverse control. The problems associated

    with direct inverse control such as process-model mismatch are reduced using

    IMC. The diagram below shows the set-up of IMC (Figure 6.14).

    )s(GP)s(GC

    OutputSetpoint

    Process

    ANN

    Input Output

    +

    -

    ProcessNN -ControlFilter

    NN-Model

    YoutUin

    d(s)

    +

    +

    -

    -

  • 7/27/2019 NNEE561 jaber

    17/19

    Figure 6.14: Diagram of internal model control (IMC)

    A neural network model is placed in parallel with the real system. The controller is

    an inverse model of the process. The filter makes the system robust to process-

    model mismatch. With the IMC scheme, the aim is to eliminate the unknown

    disturbance affecting the system. The difference between the process and the

    model d(s) is determined. If the ANN model is a good approximate of the process

    then the d(s) is equal to the unknown disturbance. The signal d(s) is the

    information that is missing from the NN-model and can be used to improve the

    control.

    Summary of Neuro-Controller MethodTo determine the type of neural controller to be used, the pros and cons of each of

    the control methods was determined specifically relating to the non-linear system

    (CPS).

    To develop a supervised neural control lerfor the non-linear system, anexisting controller is required. A controller has already been developed using

    feedback controller for the CPS [LQOSEIC or ESOSERIS]. This controller

    could be used as a teacher. The model reference controlneeded stable reference

    model. These methods will be implemented to design adaptive neuro controller

    in this thesis.

    I nverse model control and in ternal model control are both based ondeveloping an accurate inverse model of the non-linear plant. The problem with

    these methods is that if the system open loop, it will be unstable. To develop an

    inverse model, the plant must be stabilized using a controller. When a feedback

    controller is used, the inverse model contains some of the dynamics of the

    controller. The inverse model developed using a feedback controller would

  • 7/27/2019 NNEE561 jaber

    18/19

    never be accurate enough to be used in direct inverse control. This type of

    neural control is suited the control of stable open loop systems.

    6.7Non-linear Identification Using Neural Networks

    This section discusses the different methods of identifying the non-linear

    system using neural networks. The most common method of neural network

    identification is called forward modeling (Figure 6.15). During training both the

    process and ANN receive the same input, the outputs from the ANN and process

    are compared. This error signal is used to update the weights in the ANN. This is

    an example of supervised learning. The teacher model (CPS) provides target values

    for the learner (the neural network). There are two main types of neural networks(Feedforward and Elman) that will be used for identification.

    Figure 6.15: Neural network forward modeling method

    6.7.1 Feedforwad Neural Network Identification

    In order to provide a set of targets for the network to learn, the simulink

    model with feedback control is used (Figure 6.19). Initially single-input single-

    output (SISO) neural networks were developed, the input being the control force

    and the output pole angle or cart position. The first type of neural network to be

    devolved are Feed-forward. Using Matlab it is possible to develop multi-layer

    Nonlinear

    system

    CPS

    OutputInput

    update weights

    +

    -

  • 7/27/2019 NNEE561 jaber

    19/19

    perceptrons (MLP). The Matlab code creates a feedforward network model in

    Figure 6.16 presented in Appendix B.

    Figure 6.16: Feedforward neural network model