This is arguably the most useful companion repo for this specific book. It contains Jupyter Notebooks that implement the algorithms chapter by chapter.
# Apply PCA to reduce dimensionality to 2 features pca = PCA(n_components=2) X_pca = pca.fit_transform(X) introduction to machine learning ethem alpaydin pdf github