Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. (70 points) Classification of the iris flowers. You will work on the historical famous iris flower dataset (https://en.wikipedia.org/wiki/Iris_flower_d ata set). It involves 150 samples
2. (70 points) Classification of the iris flowers. You will work on the historical famous iris flower dataset (https://en.wikipedia.org/wiki/Iris_flower_d ata set). It involves 150 samples in total, which are of three iris flower species, namely, Iris setosa, Iris virginica and Iris versicolor. Each sample has four measure- ments as width and height of sepal and petal parts. You can get the dataset from below links: https://www.kaggle.com/uciml/iris https://archive.ics.uci.edu/ml/datasets/iris https://www.kaggle.com/uciml/iris/download You will implement several different perceptron training methods yourself as de- scribed below, without using any existing perceptron method. Running only a third party implementation will be graded by 0, but of course you can use existing func- tions as well to see how they work in comparison to your own implementation. (a) (30 points) In this part you will work on a subset which involves only Iris setosa and Iris versicolor samples, and only petal width and height measure- ments. Therefore, first, you have to extract this subset from the whole dataset. Since you will perform training and testing, you also have to partition the ex- tracted subset into training and testing folds. You will keep 20% of the samples for the test, and the rest for the training (so your partition will be 40/10 per class). You must use the below command with exactly the same given param- eters for the partitioning. Look at the code in the given template notebook for an example usage as well. train_test_split(X, Y, test_size=0.2, shuffle=False) You will compare the perceptron algorithm and LSME algorithm for perceptron training. You have to calculate the mean squared error (MSE) at each training epoch on the training set for convergence testing and to later plot its graph. Use an MSE convergence tolerance of le-3 (to terminate iterations early due to convergence), a fixed learning rate of le-3, and perform the iterations for at most 1000 epochs (then terminate). After training is terminated, evaluate correct recognition rates (accuracy) on training and test sets. Plot MSE-vs- Epoch graphs for the two algorithms, using the SAME axis limits (xlim and ylim functions) in order to have comparable plots. Clearly report the accuracy percentages on the training and test sets. The best way to do is to list the accuracy values in a table. (b) (30 points) In this part you will work on a subset which involves only Iris versicolor and Iris virginica samples, however, using all the four measurements. Repeat the same experiments (with the same setup) that you did in the first part for this subset. In addition to the perceptron and LMSE algorithms, you will also apply the vanilla gradient descent. Compare the performances of these 3 algorithms on the training and test sets by MSE plots and accuracy percentages, as you did in the first part. (c) (10 points) Discuss the performances of the perceptron and LMSE algorithms based on all the results you obtain. Does the performance comparison of the perceptron and LMSE algorithm change significantly from one subset to an- other? If so, try to explain the reason; or, if the comparative evaluations are similar, try to explain why so. 2. (70 points) Classification of the iris flowers. You will work on the historical famous iris flower dataset (https://en.wikipedia.org/wiki/Iris_flower_d ata set). It involves 150 samples in total, which are of three iris flower species, namely, Iris setosa, Iris virginica and Iris versicolor. Each sample has four measure- ments as width and height of sepal and petal parts. You can get the dataset from below links: https://www.kaggle.com/uciml/iris https://archive.ics.uci.edu/ml/datasets/iris https://www.kaggle.com/uciml/iris/download You will implement several different perceptron training methods yourself as de- scribed below, without using any existing perceptron method. Running only a third party implementation will be graded by 0, but of course you can use existing func- tions as well to see how they work in comparison to your own implementation. (a) (30 points) In this part you will work on a subset which involves only Iris setosa and Iris versicolor samples, and only petal width and height measure- ments. Therefore, first, you have to extract this subset from the whole dataset. Since you will perform training and testing, you also have to partition the ex- tracted subset into training and testing folds. You will keep 20% of the samples for the test, and the rest for the training (so your partition will be 40/10 per class). You must use the below command with exactly the same given param- eters for the partitioning. Look at the code in the given template notebook for an example usage as well. train_test_split(X, Y, test_size=0.2, shuffle=False) You will compare the perceptron algorithm and LSME algorithm for perceptron training. You have to calculate the mean squared error (MSE) at each training epoch on the training set for convergence testing and to later plot its graph. Use an MSE convergence tolerance of le-3 (to terminate iterations early due to convergence), a fixed learning rate of le-3, and perform the iterations for at most 1000 epochs (then terminate). After training is terminated, evaluate correct recognition rates (accuracy) on training and test sets. Plot MSE-vs- Epoch graphs for the two algorithms, using the SAME axis limits (xlim and ylim functions) in order to have comparable plots. Clearly report the accuracy percentages on the training and test sets. The best way to do is to list the accuracy values in a table. (b) (30 points) In this part you will work on a subset which involves only Iris versicolor and Iris virginica samples, however, using all the four measurements. Repeat the same experiments (with the same setup) that you did in the first part for this subset. In addition to the perceptron and LMSE algorithms, you will also apply the vanilla gradient descent. Compare the performances of these 3 algorithms on the training and test sets by MSE plots and accuracy percentages, as you did in the first part. (c) (10 points) Discuss the performances of the perceptron and LMSE algorithms based on all the results you obtain. Does the performance comparison of the perceptron and LMSE algorithm change significantly from one subset to an- other? If so, try to explain the reason; or, if the comparative evaluations are similar, try to explain why so
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started