0Pricing
Data Science Academy · Lesson

How PCA Finds Components

Variance directions, intuitively.

How PCA Finds Components is a free Data Science Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Data Science Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Variance Is Information

PCA starts from one idea: the directions where your data spreads most carry the most information. That spread is called variance.

Find the Biggest Spread

PCA hunts for the single axis along which points vary the most. That direction becomes the first principal component.

Then Go Perpendicular

The next axis must be at right angles to the first while capturing the most remaining spread. Each new component is orthogonal to the others.

Components Are New Axes

Together these directions form a fresh coordinate system. Each principal component is a blend of your original features, not just one column.

Ranked by Importance

PCA orders components by how much variance each captures, so the first few hold the bulk of the signal and the last few hold mostly noise.

Project Onto Components

To shrink your data you project it onto the top components, swapping many original columns for a few informative scores.

Explained Variance Ratio

The explained variance ratio tells you the fraction of total spread each component keeps, so you can see how much you save.

Fit It in scikit-learn

In scikit-learn you set how many components you want, then fit_transform turns your wide table into compact scores.

from sklearn.decomposition import PCA
scores = PCA(n_components=2).fit_transform(X)

Read the Ratios

After fitting, check explained_variance_ratio_ to see how much each component kept. Summing them shows your total retained variance.

pca = PCA(n_components=2).fit(X)
print(pca.explained_variance_ratio_)

Components Are Linear

Each component is a weighted sum of features, so PCA only captures linear structure. Curved patterns need other tools.

Compression, Not Magic

You trade a little accuracy for far fewer columns. Dropped components hold the least variance, so the loss is usually small.

Quick Check

One rule decides which direction PCA picks first.

Recap

PCA finds orthogonal axes of maximum variance, ranks them, and projects data onto the top ones to compress it. 🎯

Frequently asked questions

Is the “How PCA Finds Components” lesson free?

Yes — the full text of “How PCA Finds Components” is free to read here on the web, and the Data Science Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Data Science Academy course, upgrade to CoddyKit PRO.

What will I learn in “How PCA Finds Components”?

Variance directions, intuitively. You practise Data Science Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Data Science Academy?

No prior experience is required. Data Science Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “How PCA Finds Components” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Data Science Academy lesson?

Yes. Every Data Science Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The Curse of Too Many Features
  2. How PCA Finds Components
  3. Scale First, Then Fit PCA
  4. Choose Components With Scree Plots
← Back to Data Science Academy