Hey Marco! If you check out the link to the code I provided to someone else who asked for it, the sklearn library uses PCA to transform your data into a new set of data with reduced features. As for choosing the number of dimensions, if I want to visualize it, I had to choose between 3 or 2. Of course, because we see the visualizations on a 2-d surface, a 3-d plot is usually ineffective, and if you check the explained variance ratio sum for three vs. two dimensions, having three dimensions does not add a lot of explained variance. Usually for PCA visualization, we choose two dimensions, unless adding the third dimension adds a lot of explained variance. Cheers!

ML & CS enthusiast. Let’s connect: https://www.linkedin.com/in/andre-ye.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store