ECE/CS/ME 539 Introduction to Artificial Neural Networks and Fuzzy Systems
Total Page:16
File Type:pdf, Size:1020Kb
Yu Hen Hu 4/6/18 Name:______Last, First
SSN No: ______
ECE/CS/ME 539 Introduction to Artificial Neural Networks and Fuzzy Systems
Take Home Final Examination Due noon 12/17/2004
This is a take home final examination. Print a copy of this exam and then attach your answer sheets. Staple them together before turning in. You CANNOT discuss either the questions, or the answers with any one except the instructor. Save-keep your program and answer so that unauthorized intruders cannot copy them from your account without your knowledge. Safe keep your partial answers so that others cannot access them accidentally or purposely. Do not erase the programs until you receive your final grade report; as you may be requested to verify your answer by running these programs in front of the instructor. Write the answers neatly or type the answers. ABSOLUTELY NO EXTENSION REQUEST WILL BE GRANTED TO ON-CAMPUS STUDENTS. Be on time. Any academic mis-conduct will be pursued to the full extend according to University rule. You must sign below to receive credit for this final examination.
I, ______(print your name) promise that I will not commit academic plagiarism. I understand such an offense will results in failure of this course for both the person who copy other’s answer and those who let their answer copied by others.
Signed by: ______, Date: ______
IMPORTANT! Instruction for submission of the final examination paper
The final exam should be submitted by noon 12/17/2004to Room 3625 Engineering Hall.
1 of 6 Yu Hen Hu 4/6/18
Problem Max. pts Points 1 30 2 15 3 10 4 10 5 10 6 25 Total 100
1. (30 points) Fuzzy Logic Controller Design x (50, 0) (100,0) (0,0) y
(95,40)
Parking Lot ℓ
(5,95) (0,100)
Refer to the left figure above, a truck (shown on the right figure) is initially parked in a parking lot (shaded region) whose lower-left and upper-right coordinates are, respectively, (5, 95) and (95, 40), all measured in meters. The objective is to back-up this truck to the loading duck (marked with a triangle at coordinate (50, 0)) such that the center line of the truck is prependicular to the loading duck wall so that the truck faces south at that position. Surrounding the loading duck and the parking lot is a 100 meter square area surrounded by walls marked with thick lines. The truck can not hit the wall during the back-up operation. Otherwise, it is consider a failure. When the back-up operation commenses, the truck will be driven backward at a constant speed v. The driver, or the controller you are to design in this problem, is allowed to streer the front wheel by an angle within the range of (30o, 30o) measured from the truck’s
2 of 6 Yu Hen Hu 4/6/18
heading direction. (0 360o) measures the angle between the positive y axis and the heading of the truck. For example in the right figure above, the truck’s heading direction is 90o. The truck’s coordinate, denoted by (x, y) is defined as the center point between its rear wheels. The distance between the center of its front wheels to (x, y) is L, and the distance between the center of the rear end of this truck and (x, y) is ℓ. Three dynamic equations describe the truck’s movement: x(n 1) x(n) t v cos (n) cos((n) / 2) y(n 1) y(n) t v cos (n) sin((n) / 2) v sin (n) (n 1) (n) t L x(n+1) and y(n+1) are trucks new position t seconds later than x(n) and y(n) respectively. Here angles are represented in the unit of radians rather than degrees. Note that due to the dependency between x(n) and y(n), only two independent state variables x(n) and (n) will be sufficient to determine the truck’s trajectory and its heading. (a) (5 points) Let v = 4 m/s, t = 2 s, L = 1.5m, and ℓ = 0.5m. Suppose that the initial truck location (x(1), y(1)) = (50, 75), and initial heading (1) = 80o. If the truck driver maneuvers the truck with the following steering angles (in degrees) {(n); n = 1, 2, …, 10 }= {3o, 10o, 2o, 3o, 9o, 13o, 7o, 10o, 5o, 20o}. Write a program to compute the trucks positions and headings for n = 1, 2, …, 11. Submit the program source code, and tabulate the result. Also, plot the trucks (x, y) coordinates for n = 1 to 11.
n 1 2 3 4 5 6 7 8 9 10 11 x 50 y 75 (n 80 )
(b) (2 points) It is claimed that x(n) and (n) will be sufficient to determine the truck’s position and heading at each time step. Given {x(0), y(0), (0)}, and {x(n), (n); 1 n N}. Derive a (recursive) formula that does not contain (n) to compute {y(n); 1 n N}. (c) (3 points) In order to develop a fuzzy logic controller to control the steering angle at each time step, the two inputs to the fuzzy controller, x(n) and (n) need to be fuzzified. Also, the output of the fuzzy logic controller, (n) must also be fuzzified. For the time being, let us generate triangular fuzzy sets using the Matlab program fsgen.m that can be download from the Matlab programs in the course web page. Specifically, generate (i) 5 fuzzy sets for input variable x(n) [0, 100], with a support containing 25 evenly separated points in that range (including both ends). (ii) 7 fuzzy sets for input variable (n) [0, 2], with a support containing 91evenly separated points in the range (including both ends). (iii) 7 fuzzy sets for output variable (n) [/6, /6], with a support containing 61 evenly separated points in the range (including both ends). Plot these fuzzy sets. Furthermore, suppose that x(n) = 65 m, (n) = 130o, and (n) = 23o, compute the fuzified membership vectors of each of them.
3 of 6 Yu Hen Hu 4/6/18
(d) (10 points) Let v = 1 m/s, t = 0.5 s, L = 1 m. Use the fuzzy sets defined in part (c), a rule-base defined in the file ruletrk.m (downloadable from the web), and the center of area defuzzification method as implemented in defuz.m to develop a fuzzy logic controller to back-up the truck to the loading duck. A back-up operation is considered
successful if the trucks final coordinate (xf, yf) and the heading f satisfy the following o o conditions: (i) |xf 50| 2 meter, (ii) 2 yf ℓ, and (iii) |f 180 | 10 . Moreover, as stated above, in no time during the backup operation the truck may run over the wall. Hence we also require 0 x 100, and 100 y 0. (i) (5 points) Choose an appropriate initial truck position and heading [x(0) y(0) (0)], and plot the trajectory of this truck during the back-up. An example is given below. Submit a printed copy of the source code of your program as part of the answer.
t r a j e c t o r y o f t r u c k b a c k i n g t o d o c k 0
x f i n a l = 4 9 . 4 9 7 6 m e t e r y f i n a l = - 1 . 7 9 2 1 m e t e r - 2 0 p h i f i n a l = 1 8 8 . 5 1 5 6 d e g r e e .
- 4 0
- 6 0
- 8 0
- 1 0 0 0 2 0 4 0 6 0 8 0 1 0 0
(ii) (5 points) Download a file trkpos.txt from the course web site. Each row of this file spefies the intial position and heading of this truck of one trial Apply the fuzzy logic controller to each of these intial conditions. Report how many trials are successful. (e) (10 points) Use the result you obtained in part (d, ii) as a baseline performance, try to improve the performance of this fuzzy logic controller. You may modify either the definition of the fuzzy set (but the discrete support for each variable can not be changed), and the rule base. Discuss briefly the changes you have made, and report how much improvement of performance due to these changes. Also, submit your new definitions of fuzzy sets (plots like part (b)), and a print out of the rule base you used. You will receive 10 points of this part if any improvement is shown. The remaining points will be awarded roughly according to the percentage improvements. Full credit (10 points) will be given if the overall success rate 98% after improvement. 2. (15 points) Download the following two ASCII data files: p2r, and p2t. The file p2r contains
61 data points {(xn, yn); 1 n 61}. Each data point is specified in a row. The data points represent the values of an unknown noisy function yn = g(xn) + en. The testing file p2t contains 40 testing data point. In no time the testing data point should be used for the purpose of estimating the model parameters.
4 of 6 Yu Hen Hu 4/6/18 We want to develop a polynomial model for this unknown function.To determine the order of the polynomial, we use a leave-one-out (LOO) method that is described as follows in an algorithmic format:
For each particular model order k, for i = 1 to 61, use {(xn, yn); 1 n 61, n i} as the training data set to develop a kth order polynomial model and evaluate the tuning error ei using (xi, yi) as the tuning data set. 61 Compute averaged tuning error for model order k as: E(k) 1/ 61 e 2 . i1 i * * * Then select the model order k such that E(k ) < E(k) for k k .
(f) (3 points) Use the LOO method, determine the optimal polynomial order k*, and use k* in parts (b) to (e). The range of polynomial order to be tested will be 1 k 20. (g) (3 points) the corresponding polynomial function using only training set data. (h) (3 points) Plot the polynomial f(W, xn) over training samples {xn} versus yn; (i) (3 points) Plot estimated function over testing sample versus the actual testing data. (j) (3 points) Compute training and testing error using the formula:
1 N 2 y f W , x N n1 n n
where f(W, xn) is the polynomial model evaluated at xn. 3. (10 points) Given three pairs of training data as shown in the table below Labe y1 y2 l 1 0 1 0.5 1 1 0.5 1 +1 Manually find an optimal linear hyperplane L: wTx + b = 0 that separates these two classes of samples, and the shortest distance from each class of samples to L are equal and maximized. Give the parameters w, b and the shortest distance from either class of samples to L. No credit will be given without showing the derivation details. (Hint: only three points in a 2D plane, and they are linearly separable!)
4. (10 points) Consider a mixture of expert network that contains two expert models y1(x) and y2(x), as well as a two-output gating network g1(x) and g2(x). The output is
z(x) g1 (x)y1 (x) g 2 (x)y2 (x)
Assume that the expert models y1(x) and y2(x) are given, and that x is a scalar. Moreover, let
g1 (x) 1/1 exp(wx), and g2(x) = 1g1(x). Denote e(x) = d(x) z(x) as the error with respect to training sample x. Derive a gradient update formula to update the scalar weight w based on minimizing the square error e2(x)/2 5. (10 points) Suppose a gene pool consists of two genes: #1: 10111 and #2: 01010. Let each of them correspond to a state in a state space where each state is represented with a 5-bit binary vector. Show that there exist states that can never be the descendents of these two genes using either single-point or multiple-point cross-over breeding evolution. List these states. 6. (25 points) Pattern Classification
5 of 6 Yu Hen Hu 4/6/18 Use multi-layer perceptron neural network to perform pattern classification. The training data set ctrain.txt and the feature vectors of the testing data set ctest.txt can be down-loaded from the course home-page. The class labels of the testing set feature vectors are withheld. You score for this problem will be judged in part by your approach to solve the problem (5 points), and the remaining 15 points will be graded based on the relative classification rate on the testing results with respect to the best results submitted. (a) (4 points) An analysis of the data set and pre-processing procedures applied to the feature vectors. (b) (3 points) At least two different network structures you experimented, and your basis for selecting the network for testing. (c) (3 points) A table listing the training data sets, the target class label, and the class label obtained by the MLP classifier selected in part (ii). (d) (15 points) A table listing the testing feature vectors and the final classification results. The testing results must be printed on a separated page in the following format: feature 1 feature 2 feature 3 label 0.22663 0.06919 0.11662 0 or 1 … … … … Do NOT alter the order of the testing feature vectors. Each mis-classified samples causes 0.5 point deduction up to total 15 points deduction on this part.
6 of 6