We use cookies for analytics and personalized ads. We use cookies for basic analytics and, where we show ads, to personalize them. Privacy PolicyRead our Privacy Policy.
PCA squeezes many related features into a few new ones, called principal components, while keeping as much of the information (variance) as possible. It is one of the most used tools in machine learning, deep learning and data science.
Paste or type your table, press Calculate, and get eigenvalues, explained variance, loadings, scores, a biplot and a step-by-step solution. Your data stays in this browser.
New to PCA? Read the plain-English guide — from basics to advanced, with ML, deep learning and edge-AI uses.
This tool answers one question: "I have lots of related measurements. Can a few summary numbers describe them almost as well?" Imagine photographing a 3D object: PCA finds the best camera angle, so a flat photo still shows most of the shape.
One row per person, sample or reading. One column per measurement (feature). All values must be numbers. Click Example to see a filled table.
Use Paste / import to copy a table from Excel, Sheets or a CSV. The first row must be the column names.
Standardize is on and the tool keeps enough components to explain 90% of the variance. Change this in More options once you understand it.
Nothing is calculated until you press the button.
Start with the 'In simple words' box, then the Components tab to see how much each new axis explains, and the Loadings tab to see what each axis means.
Rule of thumb to remember: keep enough components to explain about 90% of the variance. Every unfamiliar word is explained in the guide below the tool.
How to fill this table: each row is one person, sample or sensor reading, and each column is one measurement (feature). Unlike regression there is no "answer" column, because PCA only looks at how the features relate to each other. The pre-filled example has five student measurements.
Untick Include to leave a column out without deleting it. Nothing recalculates automatically, so press Calculate when you're ready. Your table is saved automatically in this browser.
| # | ||||||
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | ||||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 | ||||||
| 8 | ||||||
| 9 | ||||||
| 10 | ||||||
| 11 | ||||||
| 12 | ||||||
| 13 | ||||||
| 14 | ||||||
| 15 | ||||||
| 16 | ||||||
| 17 | ||||||
| 18 |
Fill in your data above and press Calculate to see results.
Read this once and you will understand most of what the tool shows you, from the very basics to the advanced checks, and where PCA fits in machine learning, deep learning and AI on small devices. Think of PCA as finding the best camera angle: a 3D object photographed from a clever angle still shows most of its shape in a flat picture. PCA does the same for data with many columns.
When: whenever you have many numeric columns that partly repeat each other (many sensors, survey questions, image or text features) and you want fewer, cleaner ones. How: fill the table with one row per sample and one column per feature, then press Calculate. Why: to visualize high-dimensional data, speed up models, remove redundancy and noise, detect unusual samples, and cut memory and compute on small devices.
Start at Level 1. You only need the later levels once you want to check whether the analysis can be trusted.
Level 1 — The basics
One column of your data, such as height, temperature or sensor reading.
The number of features. 20 features means a 20-dimensional dataset. More dimensions means more to store, compute and understand.
How spread out a feature is. A feature that never changes has zero variance and tells you nothing.
How strongly two features move together, from −1 to +1. PCA works best when features are correlated, because then they repeat each other.
A new axis built by mixing the original features. PC1 captures the most variation, PC2 the next most, and so on. Each PC is completely uncorrelated with the others.
Keeping only the first few PCs so that many features become a few, with a small loss of information.
Dropping each data point onto the new axes to get its new coordinates, like a shadow onto a wall.
Level 2 — Reading the results
The amount of variance along a component's direction. Bigger means that component matters more.
The direction of a component, written as a list of weights, one per original feature.
The share of the total information each component holds. All ratios add up to 100%.
The running total of the ratios. Used to decide how many components to keep.
A chart of eigenvalues from biggest to smallest. Look for the elbow where the curve flattens; components after it add little.
How strongly a feature is tied to a component. The tool shows the eigenvector weights and the easier-to-read feature-component correlations.
A data point's new coordinate on a component. The scores table is your compressed dataset.
One picture with the data points (scores) and the features (arrows). Arrows pointing the same way mean the features are positively correlated.
Level 3 — Checking the analysis
Rescaling each feature to mean 0 and standard deviation 1, so every feature gets an equal say.
The covariance matrix keeps original units, so big-number features dominate. The correlation matrix is the same thing after standardizing. It is the safer default.
A rule of thumb: keep components with eigenvalue above 1 (for standardized data), meaning they explain more than a single original feature would.
Kaiser-Meyer-Olkin measure of sampling adequacy from 0 to 1. Above 0.6 is acceptable and above 0.8 is good for PCA.
Tests whether your features are correlated at all. A significant result (p below 0.05) means there is structure worth summarising.
How much information is lost when you go back from k components to the original features. Rows with a large error do not fit the main pattern, so it doubles as an anomaly detector.
Level 4 — Advanced ideas
The new axes are at right angles, which means the components are uncorrelated. That is why PCA helps with multicollinearity.
In practice PCA is computed with the singular value decomposition of the centered data matrix. The squared singular values, divided by (n − 1), are the eigenvalues.
Rescaling every component to variance 1 after PCA, so the transformed features are uncorrelated and equally scaled. Common before some neural-network and ICA pipelines.
Compute the mean, scale and components from training data, then reuse them unchanged on test data or on a device. Refitting on test data leaks information.
PCA only finds straight-line structure. For curved structure, use Kernel PCA, an autoencoder, t-SNE or UMAP.
Variants for data too big for memory (process in batches) or when you want each component to use only a few features.
A neural network with a linear bottleneck, trained with squared error, learns the same subspace as PCA. That is the bridge between PCA and deep learning.
Two standardized features, say hours studied and practice tests, have correlation 0.5, so their correlation matrix is [[1, 0.5], [0.5, 1]]. (Made-up numbers, for illustration only.)
Suppose 5 standardized features give eigenvalues 3.2, 1.1, 0.4, 0.2, 0.1 (total 5).
| Component | Eigenvalue | % of variance | Cumulative % |
|---|---|---|---|
| PC1 | 3.2 | 64% | 64% |
| PC2 | 1.1 | 22% | 86% |
| PC3 | 0.4 | 8% | 94% |
| PC4 | 0.2 | 4% | 98% |
| PC5 | 0.1 | 2% | 100% |
| Result | The big picture: how much information is kept, whether PCA suits your data (KMO, Bartlett), a plain-language summary and an on-device cost estimate. |
| Components | Every component with its eigenvalue and variance share, plus the variance chart and the scree plot. |
| Loadings | What each component means: a heat-map of feature weights and correlations, and a biplot. |
| Scores | Your data in the new coordinates (the compressed table), the reconstruction error for each row, and CSV export. |
| Learn | The whole calculation with your numbers, step by step, plus Python and R code to repeat it. |
In machine learning PCA is mostly a preprocessing and exploration step. It does not predict anything by itself, but it makes the data easier for the models that do.
| Use | How PCA helps | Example |
|---|---|---|
| Faster, simpler models | Fewer inputs means faster training and prediction, especially for k-nearest neighbours, SVM and k-means, which slow down with many dimensions. | Reduce 300 features to 20 before clustering customers. |
| Fixing overlapping features | Components are uncorrelated, so they remove multicollinearity. Regression on components is called principal component regression (PCR). | Many correlated economic indicators predicting one outcome. |
| Visualization | Plot PC1 against PC2 to see clusters and outliers in data with dozens of columns. | Show whether patients or products form groups. |
| Noise reduction | Small components are mostly noise. Keep the big ones and reconstruct to get a cleaner signal. | Denoise sensor readings or images. |
| Anomaly detection | A sample that rebuilds badly from a few components does not follow the normal pattern. | Flag a faulty machine or a fraudulent transaction. |
| Feature engineering | Components can act as new, compact features whose meaning you can read from the loadings. | An 'effort' score and a 'lifestyle' score from many survey items. |
from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from sklearn.linear_model import LogisticRegression model = make_pipeline(StandardScaler(), PCA(n_components=0.90), LogisticRegression()) model.fit(X_train, y_train) # scaler and PCA are fitted on training data only print(model.score(X_test, y_test))
Deep networks learn their own features, so PCA plays a supporting role. It is a strong, cheap baseline, and the ideas behind it appear all over deep learning.
Text and image models output vectors with hundreds or thousands of numbers (for example 768). PCA can shrink them to 128 or 256 for cheaper storage and faster similarity search, at a small cost in accuracy.
A neural network with a straight-line bottleneck trained to rebuild its input learns the same subspace as PCA. Real autoencoders add non-linear layers to go beyond it.
Standardizing or whitening inputs with PCA can make training of small networks steadier and faster, especially on tabular and sensor data.
PCA of hidden-layer activations shows how many dimensions a layer really uses. The same low-rank thinking sits behind methods such as LoRA, which adds small low-rank updates to big models.
The common recipe is PCA down to about 50 dimensions first, then t-SNE or UMAP down to 2, which is faster and less noisy than going straight to 2.
A tiny first layer needs fewer weights when it reads k components instead of p features. Try the NN Parameter & FLOPs Counter on this site to see the savings.
An edge device is a small computer close to the real world: a drone, robot, wearable, phone, camera or factory sensor. An AI agent on such a device repeatedly senses, understands, decides and acts, with very little memory, power and network bandwidth. PCA is a cheap, predictable way to keep that loop small.
Sensors give p raw numbers (IMU, vibration, audio features, camera features).
PCA turns p numbers into k. One small matrix multiplication, computed offline.
A tiny model, rule set or small on-device language model reads the k numbers and picks an action.
Motor, alert or message. Meanwhile the reconstruction error tells the agent when input looks unusual.
| Need on the device | What PCA does | Example |
|---|---|---|
| Small input for TinyML | Turns many correlated channels into a few, so the first layer of the on-device model needs fewer weights and multiply-adds. | 20 vibration features → 4 components for a motor-health classifier on a microcontroller. |
| Compact agent state | Gives the policy or planner a short, uncorrelated state vector instead of a long raw one. | A robot's many joint and IMU readings → 6 numbers for its controller. |
| Self-monitoring and safety | Reconstruction error shows when a reading does not fit normal patterns, so the agent can slow down, use a safe mode or ask a bigger cloud model. | A drone notices its sensors behave unlike anything seen in training. |
| Memory and retrieval on device | Compress embeddings of past events or documents, so more fit in RAM or flash and search is faster. | 768-number embeddings → 128 for an on-device knowledge store. |
| Bandwidth and battery | Send k numbers instead of p over BLE, LoRa or cellular, saving energy. | A wearable uploads 5 numbers per reading instead of 40. |
| Drift monitoring | Track how the variance along each component changes over time. A shift tells you the environment or the sensor has changed and the model needs updating. | Sensor ageing or a new operating environment. |
| What you see | What it means | What to try |
|---|---|---|
| Bartlett p is above 0.05, or KMO is below 0.5 | Your features are barely correlated, so there is little to compress. | PCA is the wrong tool here. Try other features, or keep the original ones. |
| PC1 explains only 20–30% and the scree plot is flat | There is no dominant pattern; information is spread evenly. | You would need many components. Consider whether reduction is worth it. |
| One feature dominates PC1 and has a huge scale | The covariance matrix is being driven by the units, not by structure. | Switch to 'Correlation matrix' (standardize). |
| A row has a very large reconstruction error | That row does not follow the main pattern (possible outlier, fault or data error). | Check the row. Remove it or keep it as an anomaly signal. |
| An error says a column has zero variance | That column has the same value in every row. | Untick Include for that column. |
| Loadings are hard to interpret | The components mix many features, which is normal for PCA. | Read only the loadings above about 0.5 in size, and look at the biplot. |
The calculator centres (and optionally standardizes) your columns, builds the covariance or correlation matrix, and finds its eigenvalues and eigenvectors with the Jacobi rotation method. Components are sorted by eigenvalue; scores are the data projected onto the eigenvectors; loadings are the eigenvectors and the feature-component correlations. Eigenvector signs are set so the largest weight is positive, which keeps results stable between runs.
Bartlett's test of sphericity uses the determinant of the correlation matrix, and KMO compares ordinary and partial correlations. Nothing is calculated until you press Calculate.