Sunteți pe pagina 1din 7

Chapter 3: Building the artificial neural network

3.1 Building the proposed prediction tool for wind speed using the ANN:
-

Data acquisition & pre-processing.

Statistical Analysis.

Design of Neural Network.

Training

Testing.

Practical work steps:

1. Data acquisition & pre-processing:


In this stage data collection has been done to the location in Vietnam, especially DaNang.
The available data about the selected location is the wind speed from 5/11/2014 to
20/11/2014 in website http://www.timeanddate.com/weather/vietnam/da-nang/historic.
Table 4.2: Available data about the selected location DaNang

0:00
1:00
2:00
3:00
4:00
5:00
6:00
7:00
8:00
9:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
18:00
19:00
20:00

5-Oct
2
4
4
6
3
6
2
2
6
11
9
11
11
28
19
30
13
11
7
7
2

6-Oct
6
0
0
2
2
6
4
4
0
2
13
20
19
20
19
20
19
15
13
13
7

7-Oct
2
6
4
7
5
7
3
4
17
22
20
24
17
15
15
22
17
9
9
2
7

8-Oct
9
2
6
2
2
2
4
4
11
19
18
22
22
26
20
20
20
19
13
11
4

9-Oct
2
2
2
2
4
6
4
4
6
8
10
15
16
26
20
20
20
9
9
2
7

10-Oct
1
0
2
2
2
6
4
4
6
4
5
9
13
20
28
15
20
17
17
11
6

11-Oct
6
4
2
4
2
6
6
2
2
6
9
11
13
18
21
20
20
17
15
9
7

12-Oct
2
2
4
4
0
2
7
2
4
6
8
10
15
20
21
26
19
16
17
11
7

13-Oct
9
2
2
2
4
4
4
6
2
6
6
11
11
22
22
23
20
18
16
12
4

21:00
22:00
23:00

2
7
4
7
15
4
13
9
6
14-Oct 15-Oct 16-Oct
0:00
0
0
2
1:00
13
1
4
2:00
7
4
7
3:00
2
7
4
4:00
2
7
0
5:00
9
6
9
6:00
6
4
6
7:00
7
4
6
8:00
7
2
4
9:00
7
6
6
10:00
6
6
4
11:00
13
11
12
12:00
20
24
15
13:00
21
20
22
14:00
23
22
25
15:00
25
23
23
16:00
18
20
21
17:00
15
17
16
18:00
14
15
17
19:00
10
12
10
20:00
2
6
4
21:00
2
0
4
22:00
4
6
4
23:00
2
7
0
a) Statistical Analysis.

6
4
2
17-Oct
6
0
2
1
4
4
2
6
2
4
10
13
18
25
24
22
23
15
16
12
4
7
2
7

4
4
6
18-Oct
7
9
11
13
20
9
9
13
20
24
19
11
17
23
23
24
22
16
15
15
9
13
4
2

2
2
2
19-Oct
6
4
4
9
6
7
7
6
9
17
14
19
19
24
22
23
20
17
14
11
7
6
6
9

4
2
2
20-Oct
6
6
9
2
0
4
4
2
4
7
12
19
17
19
19
21
19
18
15
16
4
2
2
2

4
7
9

2
0
4

Before starting with characteristics of the proposed wind speed prediction tool it was
important to analysis the available data (Input, Target data of the ANN tool), as the input,
target data is a measured data of wind speed with reading every 1 hour there it is a huge
amount of input data that need to be calcified as importance.
This can be done by statistical analysis to this input data in order to find the strength of
the relationship between the different input data specially to be related to the wind speed
(the parameter of interest for prediction).

Distribution the wind speed for 5/11 to 20/11


35
30
25
20
15
10
5
0

5-Oct

6-Oct

7-Oct

8-Oct

9-Oct

10-Oct

11-Oct

12-Oct

13-Oct

14-Oct

15-Oct

16-Oct

17-Oct

18-Oct

19-Oct

20-Oct

Figure 4.11: Distribution the wind speed for 5/11 to 20/11


Following the chart, we can recognized that the wind speed is from 0:00 to 9:00 to quite low
nearly 8 m/s; from 10:00 to 19:00 the wind speed is the highest in a day, from 20:00 to 24:00 it is
same morning.
b) Design of Neural Network.
At the beginning the approach was to get familiar with the neural network tool used in
Matlab program by trying to build a very basic and simple ANN tool for wind speed
prediction. The purpose of this basic apportion is to use the different available options in
the Matlab tool (Like different training function, activation function, and validation
function possibilities).We created the matrix 2x3 2x5 3x3 3x5 each element in matrix
is the wind speed in 24h in each day and add the time node correlate the matrix.
1. Estimating 1 day(day-by-day)
Consider we will predict wind speed day 15/10/2014 (notate its D11) in which we
use the data from 5/10/2014 to 15/10/2014 in order to compare result with others method
by building matrix data in column.
D1D11: wind speed of each hour in day so that have the matrix D1D11 has 24
elements.
The matrix 2x3

That method is only predict one day, next day of data using estimated, data is began
from D6 to D10.
We call the matrix x = [D6 D7 D8;
D7 D8 D9];
Matrix y=[D7 D8 D9;
D8 D9 D10];
Wind speed is collected every hour in one day so the time node t=[0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19 20 21 22 23]
My neural network has 4 inputs include: D6 D7 D8 D9; time node but its arranged
by matrix X=[D6 D7 D8;
D7 D8 D9;
t
t t];
we will train the system through the correlation input and output so that we have
desired function by using tool ANN in matlab.
After that, day D7 D8 D9 D10 is arranged matrix Y =[D7 D8 D9;
D8 D9 D10;
t t t];
applying the desire function for Y you calculated D11, its day we need estimating.
We do it again and add more day to build the matrix 2x5 2x7 3x3 3x5 3x7 5x3 5x5. More
data and more accuracy.
2. Estimate 3 days consecutive
This method is same idea method day-by-day but the output in network 1 is input in the
next network network 2, and output is network 2 is input in the next network- network
3; or we use desire function to estimate next 3 days consecutive.
c) Training.
In this step there is no direct low or formula to get the exact number of neurons or what is
the right training function to be used. A try and error method can be used in this case. The
different possibility can be carried out and the best will be chosen. The testing part can
show in details the best results of this part. For example the fastest training function is
generally trainlm, and it is the default training function for feed forward net. The quasiNewton method, trainbfg, is also quite fast. Both of these methods tend to be less
efficient for large networks (with thousands of weights), since they require more memory
and more computation time for these cases. Also, trainlm performs better on function

fitting (nonlinear regression) problems than on pattern recognition problems (Matlab,


2010).
During the training process, the weights are adjusted in order to make the actual outputs
(predicated) close to the target (measured) outputs of the network. In this study, 15-day
data period from 5/10 to 20/10 are used for training. MATLAB provides built-in transfer
functions which are used in this study; linear (purelin), Hyperbolic Tangent Sigmoid
(logsig) and Logistic Sigmoid (tansig). The graphical illustration and mathematical form
of such functions are shown in Table 3.1.
Table 3.1: MATLAB build-in transfer function.

d) Testing.

The results obtained from testing the trained neural network on new data for 24 hours of a
day over two-week period are presented below in graphical form. The absolute mean
error AME (%) between the predicted and actual data for each day has been
calculated and presented in the table.

equation 4.19

Where:
- n is the total number of reading (in our case is the total number of measurement
available used as target data of the ANN tool for prediction).
- is the i value of the predicted parameter.
- is the i value of the measured parameter.
With this step done we can now have more accurate understanding of the output results
not only a general over view like before. The result of this analysis will help in
differentiating between the different results.
3.2 Programming in the neural network model
4.2 Programming the neural network model

MATLAB is a numerical computing environment and also a programming language. It


allows easy matrix manipulation, plotting of functions and data, implementation of
algorithms, creating user interfaces and interfacing with programs in other languages.
The Neural Network Toolbox contains the MATLAB tools for designing, implementing,
visualizing and simulating neural networks. It also provides comprehensive support for
many proven network paradigms, as well as graphical user interfaces (GUIs) that enable
the user to design and manage neural networks in a very simple way
(http://www.mathworks.com/products/neuralnet).
MATLAB helps devise the MLP model by using the built-in function newff which creates a
feed-forward back-propagation network. The designer can specify the number of hidden layers,
the neurons in each layer, the transfer function in each layer, the training function, the
weight/bias learning function, and the performance function. Moreover, this command will
automatically initialize the weights and biases. The function is called as follows:
We configure the neural network with the command newff. Newff create a feed-forward back
propagation network.

Newff (P,T,S,TF,BTF,BLF,PF,IPF,OPF,DDF) takes optional inputs,

TFi - Transfer function of ith layer. Default is 'logsig' for hidden layers, and 'purelin' for
output layer.

BTF - Backprop network training function, default = 'trainlm'.

BLF - Backprop weight/bias learning function, default = 'learngdm'.

PF - Performance function, default = 'mse'.

IPF - Row cell array of input processing functions. Default is {'fixunknowns',


'remconstantrows', 'mapminmax'}.

OPF - Row cell array of output processing functions. Default is {'remconstantrows',


'mapminmax'}.

DDF - Data division function, default = 'dividerand';

net.trainParam.epochs = 100000 (maximun epoch is 100000)


net.trainParam.goal = 1e-3 (maximun error of system).

net1=train(net1,X1,o1)
we will train system so that input data (X1) after going through the neural network (net1) will become
output (o1).

Net1 is a variable name which can be changed according to the network train function and
configuration in order to yield a meaningful name.
When the training is complete, the network performance should be checked. Therefore,
unseen data (testing) will be exposed to the network. The testing simulation process is called
with the statement: D11est=sim(net1,Y1);

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