Question: Load Iris dataset. It includes 3 classes (Setosa, Versicolor, and Virginica flowers). There are 4 features per sample (Sepal-length Sepal-width Petal-length Petal-width), and there are
Load Iris dataset. It includes 3 classes (Setosa, Versicolor, and Virginica flowers). There are 4 features per sample (Sepal-length Sepal-width Petal-length Petal-width), and there are 50 samples for each class totaling 150 samples. print features of the first 10 samples. Import numpy library and use mean and std methods to transform the data to center it by removing the mean value of each feature, then scale it by dividing non-constant features by their standard deviation. Perform 2-D plot all combinations of features (12 figures) using matplot library and scatter method (like figure below). Use PCA method in the sklearn library to find the first 2 principal components. Then, plot them for the 3 classes. Use LinearDiscriminantAnalysis method in the sklearn library to maximize the separation between the 3 classes. Compare LDA with PCA.
- Can you please use Python programming language for solving this question, thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
