Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide number 1 EE3P BEng Final Year Project Group Session 2 Processing Patterns using a Multi- Layer Perceptron (MLP) Martin Russell.

Similar presentations

Presentation on theme: "Slide number 1 EE3P BEng Final Year Project Group Session 2 Processing Patterns using a Multi- Layer Perceptron (MLP) Martin Russell."— Presentation transcript:

1 Slide number 1 EE3P BEng Final Year Project Group Session 2 Processing Patterns using a Multi- Layer Perceptron (MLP) Martin Russell

2 Slide number 2 Objectives To show you how to classify patterns using a type of artificial neural network To introduce the Multi Layer Perceptron (MLP) To describe the MLP software provided and to show you how to use it To set some practical work to be completed before the next session

3 Slide number 3 The Application Classification of spoken vowels from their first 2 formant frequencies, F1 and F2 Use a well-known set of data, collected by Peterson & Barney in 1952 Called the “Peterson-Barney” data

4 Slide number 4 Petersen Barney data 76 people (33 male, 28 female, 15 children) each spoke 2 examples of 10 vowels – 1520 utterances. For each utterance, Peterson & Barney measured: –F0: the fundamental frequency –F1, F2 and F3: the frequencies of the first 3 formants We will just use F1 and F2

5 Slide number 5 The Vowels 1.IY “beet” 2.IH “bit” 3.EH “bet” 4.AE “bat” 5.AA “bott” 6.AO “bought” 7.UH “book” 8.UW “boot” 9.AH “but” 10.ER “bird”

6 Slide number 6 Peterson & Barney F1 F2 data

7 Slide number 7 The Basic Idea F1F2 IY IH EH AE AA AO UH UW AH ER MLP e.g: F1 F2 correspond to ‘AO’

8 Slide number 8 Understanding the MLP ? F1F2 “AA” F1F2 “AA” F1F2 “AA”

9 Slide number 9 A Multi-Layer Perceptron (MLP) Input units Output units “hidden” units, “artificial neurones”

10 Slide number 10 An “artificial neurone” x y 1 (constant) w1w1 w2w2 w3w3 h Input to h is given by: I(h) = w 1 x + w 2 y + w 3 Output from h is given by: O(h) = g(I(h)) ‘Sigmoid’ activation function

11 Slide number 11 The ‘sigmoid’ activation function g Value of k

12 Slide number 12 Artificial neurone (summary) The input I(h) to the hidden unit h is the weighted sum of the outputs from the inout units above it If I(h) > 0, O(h) ~ 1 (neurone ‘fires’) If I(h) < 0, O(h) ~ 0 (neurone doesn’t ‘fire’)

13 Slide number 13 Back to the P&B data For the Peterson & Barney application we use: –3 input units: 1 st for F1, 2 nd for F2, and 3 rd set equal to 1 –10 output units, 1 for each vowel class –Variable number of hidden units

14 Slide number 14 Example ‘P&B’ MLP 3 input units 10 output units

15 Slide number 15 ‘Winner takes all’ coding This is the scheme for coding the outputs, or ‘targets’ for the MLP If F1, F2 correspond to IY, target is (1,0,0,0,0,0,0,0,0,0) If F1, F2 correspond to IH, target is (0,1,0,0,0,0,0,0,0,0) If F1, F2 correspond to EH, target is (0,0,1,0,0,0,0,0,0,0) …. If F1, F2 correspond to ER, target is (0,0,0,0,0,0,0,0,0,1)

16 Slide number 16 “Black Art”: input scaling With MLPs it is normal to scale each input so that the average is 1 and variance is 1 For the Peterson & Barney F1 and F2 data I have: –Replaced F1 with (F1 – av(F1))/sd(F1) –Replaced F2 with (F2 – av(F2))/sd(F2) av = average, sd = standard deviation

17 Slide number 17 Data file format ‘header’ information Input values (F1 F2 1) Target values

18 Slide number 18 Data Files There are two data files –pbData_m_f1f2_norm_train (the training set) –pbData_m_f1f2_norm_test (the test set) Both are on the web site

19 Slide number 19 How to build an MLP 1.First decide how many hidden units 2.Then choose initial estimates for each of the MLP parameters. Often these are chosen at random Use MLPInit.c from website MLPInit.c sets the weights randomly

20 Slide number 20 Using MLPInit MLPInit init_3x5x10 Creates an MLP with: 3 input units 5 hidden units 10 output units Result is stored in the file init_3x5x10

21 Slide number 21 Example output from MLPInit See website

22 Slide number 22 MLP Training Suppose you have: –Input values , and –Target values If you apply to the input of your MLP, then you would like output to be target The (squared) difference between the target output and actual output is called the Error By adjusting the MLP weights this error can be reduced The algorithm for reducing this error is called Error Back-Propagation

23 Slide number 23 MLPTrain.c MLPTrain.c implements the Error Back- Propagation training algorithm It’s available on the website

24 Slide number 24 How to use MLPTrain.c Type: MLPTrain initMLP dataFile numIt trainedMLP initMLP is the ‘initial’ MLP (e.g. ini_3x5x10) dataFile is the training data file (e.g. pbData_m_f1f2_train) numIt is the number of iterations trainedMLP is the file for the optimised MLP Example: MLPTrain ini_3x5x10 pbData_m_f1f2_train mlp_3x5x10

25 Slide number 25 Example MLPTrain ini_3x5x10 pbData_m_f1f2_train mlp_50000_3x5x10

26 Slide number 26 Testing the MLP Use the test set pbData_m_f1f2_norm_test –Consists of 200 test F1 F2 patterns Want to input each test pattern and see if the MLP gives the ‘correct’ output pattern The output is correct if the output unit with the biggest value corresponds to the ‘1’ in the target

27 Slide number 27 Testing the MLP Example 1: –Output = –Target= –Correct Example 2: –Output = –Target= –Error

28 Slide number 28 MLPClass.c To test your MLP use MLPClass.c from the website MLPClass mlpFile testData Where: –mlpFile is the trained MLP file –testData is the test data file Example: MLPClass mlp_3x5x10 pbData_m_f1f2_test

29 Slide number 29 Note on the C programs All of the C programs are ANSI C compatible They were developed under linux, but that doesn’t matter They should compile on any platform I recommend the command-line C compiler under MS visual

30 Slide number 30 More “black art” The programs MLPTrain and MLPClass need a set of parameters These are stored in a file called mlpconfig (see website) This file must be in your directory when you run MLPTrain or MLPClass

31 Slide number 31 mlpconfig BATCH This file is on the website Options for are BATCH or SEQUENTIAL is just k from slides 10 and 11

32 Slide number 32 Tasks Download C programs from the website Compile them Download Peterson & Barney data from the website Follow the steps outlined in these slides to build and test some MLPs –How many hidden units do you need? –How many iterations of training are needed? –What recognition rate can you achieve? –What the ‘learning rate’ and ‘momentum’ and how do they affect the results? Find out more about how an MLP works

Download ppt "Slide number 1 EE3P BEng Final Year Project Group Session 2 Processing Patterns using a Multi- Layer Perceptron (MLP) Martin Russell."

Similar presentations

Ads by Google