1. Engineering
  2. Computer Science
  3. import the iris data using with python import numpy as...

Question: import the iris data using with python import numpy as...

Question details

import the iris data using: [WITH PYTHON]

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from sklearn import datasets

iris = datasets.load_iris()

Task:

Problem 3: Perceptron learning algorithm (30 points) 1. Apply the Scikit-learn implementation of PLA (see sklearn.Linear model.Perceptron to optimally (linearly) separate first the Iris setosa (class 0) from the other two species. Report the numerical error rate (Perceptron.scorep. Visualize the separation plane in 2-dimenional PCA space. (15 points) For plotting the hyperplane, you may find this useful: 1 interNum 100 2 xx8= np.linspace(X[ : , θ ].min ( ), X[:,θ].max ( ), interNum) 4 xxn= np.iinspace (XL:,n].min ( ), X[:,n].max (), interNum) 6 gridData np.array (np.meshgrid(xx0, .. ., xxn)) .T.reshape (-1,n) 7 gridPrediction = . . . # prediction boundary set 9 gridDataBoundgridData[np.abs(gridPrediction) SOME DISTANCE, :] 10 gridDataBoundPCA .. . 2. With the same PCA space as above, keep using PLA to separate the other two species (class 1 & 2). Report the numerical error rate and visualize the separation plane in 2-dimensional PCA space. (15 points)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution