Principal Components
The principal components of a fitted PCA object are stored in components_, with one row per component ordered by importance and one column per original feature.
Why the New Axes Are Hard to Name
Once you have fitted PCA and projected your data onto the new axes, the next question is usually what those axes mean. A scatter plot of the first two principal components can look clean and informative, yet the axes rarely carry a label you can read off directly. Each axis points along a direction in the original data space, and that direction is not one of the measurements you originally collected. It is a mixture of them.
This article closes that gap. You will learn where the information describing each axis is stored, how to lay it out so the numbers can be read, and why the mixing of features is the source of most of the difficulty. The goal is not just to print the numbers but to know what they say about the data and to recognize when a reading of them is wrong.
Finding the Components in a Fitted Object
After a PCA object has been fitted, the directions it found are kept in an attribute called components_. You do not need to compute them again; you read them from the fitted object. Each direction is one principal component, and the components are ordered by importance. The first one captures the largest share of the variance in the data, the second captures the next largest, and so on.
(2, 30)
[30 weights for the first component, printed as a row of numbers]
[single number: the weight of feature 5 in the second component]- The shape reports the layout before any value is read: the first number is the count of components, the second is the count of original features.
- Indexing with [0] selects the first row, which holds the full set of weights for the first component.
- Python counts from zero, so the second component is row index 1 and the fifth feature is column index 4.
The shape tells you the layout before you look at a single value. The first number is the count of components, here 2. The second number is the count of original features, here 30. So the array has one row per component and one column per feature. Each row is a direction, and each column is a feature that the direction draws on.
Reading the matrix correctly depends on remembering what rows and columns stand for. A row answers the question: which combination of features makes up this component? A column answers the question: how much does this one feature contribute to each component? Reading in the wrong direction produces confident but meaningless statements, so check the orientation before anything else.
Each Component Draws on Every Feature
A principal component is never built from a single measurement. Its direction is spread across all of the original features at once, so every feature has some weight in it. This is the reason the axes are hard to name. An axis called after one measurement would be easy to explain; an axis built from thirty interacting measurements is not, because its meaning is a pattern across all of them.
In this notation, the original features are $x_1$ through $x_{30}$, and each weight $w$ is one entry of components_. The first row of the array holds the 30 weights for the first component. Each weight says how strongly that feature pulls the component's direction. A large weight in absolute value means the feature matters more to that direction; a weight near zero means the feature barely contributes to it.
The formula above is the pattern the array encodes: one weighted sum per component, with a weight for each of the 30 features. Every term is present, which is why the component is a combination of all of them rather than of a chosen few.
The weights can also disagree with one another in sign. Some features may push the component in one direction while others push it the other way. A mixed-sign pattern tells you the component is contrasting groups of features rather than measuring one overall quantity. The same sign shared by several features means those features tend to rise and fall together along that axis, while features with opposite signs trade off against each other.
Reading a Heat Map of Coefficients
A table of 60 numbers is hard to scan. A heat map turns each coefficient into a colored cell, so you can see the sign pattern and the relative size of the weights at a glance. The source demonstrates this with the first two components of a breast cancer dataset, where the columns are the 30 features and the two rows are the components.
In the heat map, the first component has a single sign across its row, so its colored cells are uniform in tone, which marks a general correlation among the features. The second component's row is split between two tones, reflecting its mixed signs. Both rows touch every column, which is the visual version of the point that every feature participates.
To find features that move together, look for columns whose cells share a tone within the same component. Features that land in the same tone group are the ones that rise and fall together along that axis. Features in opposite tone groups trade off against each other. Before you name a group, though, check the printed numbers, since the color alone does not give you the exact weights.
Where Interpretations Go Wrong
When an interpretation disagrees with what you expected, the useful question is where in the chain the mismatch enters. The chain runs from the fitted object, to the components_ attribute, to the printed numbers, to the written description. Most errors happen at one of two links: the orientation of the array, or the text you wrote about the numbers.
Common mistake Reading the rows as features and the columns as components
What it looks likeConcluding that feature 5 contributes to component 2 by reading across the wrong axis of the array.
Why it failsEach row is a component and each column is a feature. The orientation determines which question the numbers answer.
Do this insteadCheck the shape first: the first number is the component count and the second is the feature count. Then read one row per component.
Common mistake Treating a negative weight as meaning the feature is unimportant
What it looks likeDismissing a feature because its weight in the first component is negative.
Why it failsThe sign shows direction along the axis. Importance is related to how large the weight is in absolute value.
Do this insteadCompare absolute values to judge contribution, then use the sign to describe which features pull in opposite directions.
Common mistake Treating a component as if it were a single feature
What it looks likeWriting that the first component is simply the measurement of one named feature.
Why it failsEvery component is built from all original features, each with its own weight.
Do this insteadDescribe the component as a pattern across many features, and name the features with the largest absolute weights as the main drivers.
Common mistake Trusting a heat map's color pattern without checking the printed numbers
Predicting the Sign Reading
What do you think happens?
A feature has a negative weight in the first principal component. Does that mean the feature is unimportant to that component?
Reveal answer
No, the sign gives direction and the size gives importance
A weight's sign shows which way the feature pulls the component's direction. Its absolute value shows how strongly it contributes. A large negative weight can be one of the most important contributors.
Reading One Component Row
Reading a three-feature component
A fitted PCA object has components_ with shape (2, 3). Suppose the second row is [0.6, -0.5, 0.1]. Which features contribute most to the second component, and which features pull in opposite directions?
- 1Check the layout
The shape (2, 3) means two components and three original features. The second row, which is index 1 in Python, belongs to the second component.
- 2Rank by absolute size
The absolute values are 0.6, 0.5, and 0.1. The first feature contributes most, the second is close behind, and the third barely contributes.
- 3Read the signs
The first feature has a positive weight and the second a negative one. They pull the component's direction in opposite directions, so they trade off against each other along this axis.
- 4Write a supported claim
A supported statement is that the second component contrasts feature 1 with feature 2, while feature 3 has little influence on it.
The second component mainly contrasts feature 1 against feature 2. Feature 3 barely contributes, and the sign alone does not make feature 2 unimportant.
Using the same shape and the row [0.6, -0.5, 0.1] from the example, write one sentence describing the first component's pattern if its row were [0.4, 0.4, 0.3]. Explain whether features in that component would tend to move together or trade off.
Hints
- Check whether all the signs in the row are the same.
- A single shared sign means the features tend to rise and fall together.
Summary of Reading Principal Components
- 1Principal components are stored in components_, one row per component ordered by importance and one column per original feature.
- 2Each component is a weighted combination of all original features, so its meaning is a pattern across the whole dataset.
- 3Mixed signs mean features contrast with one another; a shared sign means they tend to move together.
- 4Judge contribution by the absolute size of a weight, and check the printed numbers before trusting a heat map or a written description.
At a glance
- Principal components are stored in components_, one row per component ordered by importance and one column per original feature.
- Each component is a weighted combination of all original features, so its meaning is a pattern across the whole dataset rather than a single measurement.
- Mixed signs mean features contrast with one another, while a shared sign means features tend to rise and fall together.
- A weight's size, not its sign, indicates how much a feature matters; always check printed numbers against a heat map and verify row and column orientation first.