Artificial intelligence
HW1 – ECE 436 - AI – Due Oct. 23, 2017
Part A (50pt). You will need to use the Iris Dataset at the end of this assignment. A1. Find the Euclidean distances between a) data points d2 and d5 b) between data points d8 and d3 A2. Find the Manhattan distances between a) data points d2 and d5 b) between data points d8 and d3 A3. (a) Consider that the point d1 is the test point and its class label needs to be found and the remaining nine points are in the training points. Find the label of d1 by using one nearest neighborhood method (1NN). Does 1NN give the correct result as we know that d1 belongs to class 2 which is Iris versicolour. (b) Repeat part (a) for point for d2 being the test point and the remaining nine points d1, d3, d4, …, d10 are the training points. Check if 1NN classification gives the true class iris-virginica. (c) Continue to do part (a) for each of the remaining points. Count the number of errors and specify the error rate which is the number of errors divided by total number of test points. In this case the total number of test points is 10 since each point becomes a test point in turn. A4. Repeat the problem P3 for 3NN. A5. Repeat the problem P3 for 5NN.
Part B (50pt) – Use the balloons dataset for these problems B1. Construct a tree by starting from the root node. You need to calculate gains for each attribute and choose the largest one. B2. Check if the constructed tree yields the correct results for each point in the dataset. B3. Which class would be assigned for the following four points when you use the decision three in B1. What is the error rate? Note that each of these four points have their true class labels specified as the last entry below:
YELLOW,LARGE,DIP, CHILD,F YELLOW,LARGE,STRETCH,CHILD,F PURPLE,SMALL,DIP, CHILD,F PURPLE,LARGE,STRETCH,ADULT,T
Iris Dataset https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.names Attributes: SL: sepal length in cm SW: sepal width in cm PL: petal length in cm PW: petal width in cm Classes: 1. Iris Setosa 2. Iris Versicolour 3. Iris Virginica Points /-------Attributes----------\ Class SL, SW, PL, PW, d1 , 5.7, 2.8, 4.5, 1.3, Iris-versicolor d2 , 5.9, 3.0, 5.1, 1.8, Iris-virginica d3 , 4.9, 3.0, 1.4, 0.2, Iris-setosa d4 , 6.4, 3.2, 4.5, 1.5, Iris-versicolor d5, 6.5, 3.0, 5.2, 2.0, Iris-virginica d6, 4.6, 3.1, 1.5, 0.2, Iris-setosa d7, 6.3, 3.3, 4.7, 1.6, Iris-versicolor d8, 6.7, 3.0, 5.2, 2.3, Iris-virginica d9, 5.4, 3.9, 1.7, 0.4, Iris-setosa d10, 6.5, 2.8, 4.6, 1.5, Iris-versicolor
Balloons Dataset (1) https://archive.ics.uci.edu/ml/datasets/Balloons (2) https://archive.ics.uci.edu/ml/machine-learning- databases/balloons/adult+stretch.data Class T : Inflated F : Not inflated
Color, Size, Act, Age, Class YELLOW,SMALL,STRETCH,ADULT,T YELLOW,SMALL,STRETCH,CHILD,F YELLOW,SMALL,DIP, ADULT,F YELLOW,SMALL,DIP, CHILD,F YELLOW,LARGE,STRETCH,ADULT,T YELLOW,LARGE,DIP, ADULT,F PURPLE,SMALL,STRETCH,ADULT,T PURPLE,SMALL,STRETCH,CHILD,F PURPLE,SMALL,DIP, ADULT,F PURPLE,LARGE,STRETCH,ADULT,T PURPLE,LARGE,STRETCH,CHILD,F PURPLE,LARGE,DIP, ADULT,F PURPLE,LARGE,DIP, CHILD,F