2
The Geometric Structure of Vector Spaces
Let’s revisit the Iris dataset introduced in the previous chapter! I want to test your intuition. I plotted the petal widths against the petal lengths while hiding the class labels in Figure 2.1:
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
# Load the iris dataset
iris = load_iris()
data = iris.data
# Extract petal length (3rd column) and petal width (4th column)
petal_length = data[:, 2]
petal_width = data[:, 3]
with plt.style.context("/span>seaborn-v0_8":
# Create the scatter plot
plt.figure(figsize=(7, 7))
plt.scatter(petal_length, petal_width, color=’indigo’, alpha=0.8, edgecolor=’none’, s=70, marker=’o’)
plt.xlabel(’petal length (cm)’)
plt.ylabel(’petal width (cm)’)
plt.show()