Exploring patterns enriched in a dataset with contrastive principal component analysis
Paper · 2018 · Abubakar Abid, Martin Jinye Zhang, Vivek Bagaria et al.
Summary
A scatterplot can give an accurate picture of the largest differences in a dataset and still hide the differences that prompted the study. In images made by placing handwritten digits over photographs of grass, for instance, the grass can account for more of the variation than the shapes of the digits. Principal component analysis, or PCA, gives priority to the directions along which observations spread out the most. Abid and colleagues ask how those priorities should change when an investigator has a second collection of observations that captures some of the variation obscuring the pattern of interest.
Their method, contrastive principal component analysis, or cPCA, estimates how features vary together in the target and background datasets. It scales the background covariance matrix by a contrast parameter, subtracts it from the target covariance matrix, and extracts the eigenvectors with the largest eigenvalues. These vectors supply the axes for plotting the target. An axis earns a high score when the target spreads out substantially along it and the background spreads out relatively little. Setting the contrast to zero recovers PCA. The authors also give a way to turn a sweep of contrast strengths into a small collection of distinct views, since several strengths can produce nearly the same projection.
In the constructed image example, grass-only comparison data help bring the handwritten digit groups into view. In protein measurements from mice exposed to shock, a comparison with unexposed mice makes groups associated with Down syndrome easier to see. With single-cell measurements from leukemia patients, a healthy reference gives clearer views of differences between samples collected before and after transplantation. A contrast against broader ancestry variation also brings out geographic relationships among people from Mexican states. The experiments judge these changes mainly through scatterplots and, for the digits, through maps of the weights assigned to individual pixels.
The paper characterizes the variance tradeoffs available to the leading contrastive direction and gives a convergence rate for estimating that direction from samples. These results concern what the covariance procedure can recover. The scientific meaning of a visible group still depends on the choice of background and on follow-up analysis. The authors frame cPCA as a way to investigate variation within the target and generate hypotheses. Its projections come without significance tests, and their geometry alone gives no causal account of the patterns. The accompanying Python implementation includes documentation, examples, and notebooks for reproducing most of the figures.
Deep dive: Exploring patterns enriched in a dataset with contrastive principal component analysis
Contrastive PCA uses a background dataset to reveal patterns that ordinary PCA can miss, from handwritten digits to fine-scale genetic ancestry. · about 34 minutes to read
The problem and its context
When the main source of variation answers a different question
An observation can consist of a long list of measurements. An image has a value at each pixel, and a biological sample can have a value for each measured protein or gene. Dimensionality reduction turns those lists into a smaller number of coordinates. A low-dimensional display lets a reader see whether observations bunch together, change gradually across the plot, or stand apart from the rest. The choice of coordinates determines which of those features reach the display.
PCA constructs each coordinate from a weighted combination of the original measurements. Its first axis is the direction along which the observations have the greatest variance, or spread about their average. Further axes capture further variation while remaining perpendicular to those already chosen. The rule is useful when the largest differences are themselves the subject of the investigation. It also explains why a faithful account of overall variation can be an uninformative picture of a particular phenomenon. If several processes contribute to the measurements, the largest one can occupy the first axes and leave little room for a smaller but coherent pattern.
The authors introduce this distinction with an imagined study of gene expression in cancer patients. A researcher wants to see whether the patients form groups corresponding to molecular subtypes. The patients also differ in demographic characteristics, and those differences can contribute substantial variation to gene expression. A leading component could describe those demographic differences quite well. The study would still need another view to see whether the cancer measurements vary systematically in a way that suggests subtypes.
Now consider what a healthy group with a similar demographic composition contributes to that study. Its members can also differ along ordinary demographic lines. Their measurements can therefore suggest which combinations of genes vary in the absence of the disease-related diversity under investigation. The comparison supplies evidence about a recurring source of spread. The researcher can use that evidence while exploring the patients, even if the patient subtypes are unknown at the outset.
The grass and digit example makes the same problem tangible. Changes in shade or texture can affect many pixels at a time, and they can recur across photographs with different digits. A projection that devotes its leading axes to those changes may place pictures of different digits close together merely because their grass looks similar. A collection of photographs containing grass alone gives the analysis a way to detect such patterns of joint pixel variation. The comparison is useful even when it uses other photographs, because its role is to describe a recurring kind of variation.
What separate projections ask of the analyst
The paper describes a common workflow in which an investigator runs dimensionality reduction on each dataset and then compares the displays by eye. This gives each collection its own view, chosen according to its own structure. With separate PCA analyses, for example, a horizontal coordinate in one plot can represent a different combination of the original features from the horizontal coordinate in the other. Even when the same source of variation is visible in both, the investigator must establish the connection. A pattern that becomes interesting specifically because it is more pronounced in one dataset may fail to lead either display.
The paper also discusses t-SNE and multidimensional scaling. It describes their ability to represent structure beyond a linear PCA projection, and describes multidimensional scaling in terms of preserving distances between observations. The question raised by cPCA concerns the information used to choose the representation. A more flexible display of a single dataset still leaves the analyst to work out what the target has in common with the background and where the target differs. The comparative objective lets the second collection influence the choice of axes from the start.
Principal component pursuit addresses a different source of difficulty. As the authors describe it, the method seeks a low-rank representation in the presence of small entrywise disturbances and large errors affecting relatively few entries. The grass in the image example illustrates why this kind of robustness leaves a separate question open. Grass texture can account for systematic variation across many observations and many features. Its contribution is an ordinary part of the way the images were assembled. It becomes a nuisance because the investigator wants to study the digits. The goal of the study, informed by the second dataset, determines which coherent variation to discount.
Other work discussed in the paper uses multiple datasets to look for related patterns across them. That goal makes recurring structure across datasets a candidate for closer examination. In cPCA, recurring structure can instead supply the evidence for reducing a direction’s priority. The role of shared covariance depends on the question. A study of common variation would want to describe it, while a study of variation enriched within a target might want to look beyond it.
Which groups are known and which are being sought
The word “contrastive” can suggest a decision about whether each observation belongs to the target or the background. The authors give the two collections a different role. Their membership determines which covariance estimates enter the calculation. The output is a set of coordinates for studying differences among the target observations themselves. In the hypothetical cancer example, the analyst knows which measurements come from patients and which come from healthy people, while the proposed molecular groupings within the patient data remain open.
This makes the use of supervision precise. Linear and quadratic discriminant analysis, supervised PCA, and QUADRO appear in the paper as methods whose goals involve labeled discrimination or prediction. The cPCA objective takes no labels for the internal target groups. In the mouse study, shock exposure defines the collections used in the covariance comparison. Down syndrome status is the label the authors use to interpret the result afterwards. A direction sensitive to shock exposure and a direction separating groups among exposed mice address distinct empirical questions. Success on either question leaves the other to be investigated.
The paper also makes room for domain-specific procedures. It cites earlier population-genetics work designed to visualize fine-scale ancestry and recognizes the advantage of a method built around knowledge of the particular problem. Such knowledge can guide which variation to keep and how to represent relationships among groups. Designing and applying a specialized procedure can also demand more expertise and computation. The authors’ aim is a general extension of the familiar PCA workflow for settings where the investigator already has related collections of measurements and a reason to compare their covariance.
The method, step by step
Give the two datasets distinct jobs
The target is the collection whose internal arrangement the investigator wants to see. The background supplies examples of variation that should have less influence on that view. The assignment can change with the question being asked. For a study of differences among patients, healthy measurements might give a picture of ordinary population variation. In a study of how observations spread out at a later time, earlier measurements might supply the baseline. Both uses begin by asking which variability the comparison can reasonably represent.
The paper sketches several other choices. A homogeneous group can supply information about variability within a population when the target mixes different groups. Measurements taken before treatment can serve as the background when the question concerns structure visible after treatment. Recordings made without a signal can provide information about measurement noise in recordings that contain a signal. In each case, the background gives the algorithm a statistical description of some variation that the analyst has a substantive reason to discount.
Both collections use a common set of features, in the same correspondence. A pixel position, protein measurement, or gene expression feature has to play the same role in the two matrices for subtraction to express the intended comparison. Sample correspondence is a separate matter. The procedure estimates each matrix using the observations in its own collection, so data can be unpaired and the collections can have unequal sizes. For instance, the grass-only photographs supply a covariance estimate for pixel values on the same grid as the digit composites. Each composite can be analyzed without identifying a particular grass photograph as its control.
From a background comparison to representative target views
The steps in order.
This procedure has a part defined by the data and a part defined by the analyst’s question. The eigendecomposition and the selection of representative views follow from the covariance inputs. What those views are contrasts of depends on how the two collections were constructed and which variation the background is expected to carry.
Calculate spread in the same direction twice
A covariance matrix records the variances of the individual features and the covariances of feature pairs. A covariance entry describes how deviations of one feature from its mean tend to accompany deviations of another. In a photograph, neighboring pixel values can brighten or darken together. A direction that weights several such pixels can therefore pick up substantial variation even when attention to each pixel separately would give little sense of the overall pattern.
The paper writes xᵢ and yᵢ for observations drawn from the target and background, respectively. The subscript i identifies an observation within its own collection. Every observation has d real-valued coordinates, where d is the common feature dimension. The empirical covariance matrices, meaning those estimated from the observations, are Cₓ for the target and Cᵧ for the background. A direction v has a weight for each of the d features. Projecting an observation along v produces a coordinate by combining its feature values with those weights. Varying the observation while keeping v fixed gives a collection of coordinates whose variance can be measured.
The authors restrict the direction to a common length. In compact notation, the restriction is as follows.
ℝᵈ_unit = {v ∈ ℝᵈ : ‖v‖₂ = 1}
Here ℝ is the real number system, the superscript d gives the number of coordinates, and ℝᵈ_unit denotes the unit vectors in that space. The braces specify a set, ∈ means membership in a set, and the colon introduces the condition for membership. The notation ‖v‖₂ gives the Euclidean length of v, required to equal 1. This fixes the overall scale of the weights. Increasing the length alone would increase projected spread without changing the orientation in feature space.
For any such direction, its variance in the target follows from the target covariance.
λₓ(v) = vᵀ Cₓ v
The function λₓ(v) is the target variance along v. The label X, represented by the subscript ₓ, refers to the target collection. Cₓ is its empirical covariance matrix. The superscript T signifies transpose, so vᵀ writes the direction as a row and v on the right is a column. Multiplying the matrix between these two forms of v combines the covariances according to the feature weights and yields a single variance.
The calculation repeats with the background covariance, using the same weights.
λᵧ(v) = vᵀ Cᵧ v
The function λᵧ(v) gives background variance along the direction v, and the label Y in the subscript refers to the background. Cᵧ denotes the background empirical covariance matrix, and vᵀ again denotes the transpose of v. The same v appears in both variance calculations. That is what makes it possible to ask how much the spread along a particular coordinate changes when the underlying collection changes.
Each calculation concerns spread within its own dataset. A shift of all background observations by the same amount changes the average position of that collection and leaves its covariance intact. Separate covariance estimates thus make cPCA sensitive to how the observations vary around their respective averages. The quantity being compared is also richer than a list of feature variances. Two features can contribute to a contrast through the way they vary jointly, which matters when the signal is represented by a shape or by coordinated changes across biological measurements.
Turn the two variances into an objective
The authors use α, the contrast strength, to specify how much background variance costs. It takes non-negative values. The direction sought by cPCA maximizes a score with a reward for target variance and a deduction for background variance.
v* = argmaxᵥ ∈ ℝᵈ_unit [λₓ(v) − α λᵧ(v)]
Here v* denotes a maximizing direction, and the star marks the selected optimizer. The notation argmax asks for a choice of v that attains the highest score inside the brackets. The constraint v ∈ ℝᵈ_unit restricts the choice to real unit vectors of dimension d. The functions λₓ and λᵧ give the target and background variances along v, and α multiplies the background variance before it is subtracted.
A direction can have considerable spread in both datasets and still receive a high score if the target spread is large enough for the selected α. A direction with more modest target spread can come to the fore when it carries considerably less background variance. This tradeoff allows the method to look for a pattern whose signal would be small by the standards of ordinary PCA but relatively strong against the particular comparison. Its visibility depends on competing directions as well as on its own variance pair.
The choice of a weighted difference makes the objective easy to express as a single matrix calculation. Substituting the two variance expressions and collecting their common factors gives the equivalent problem.
v* = argmaxᵥ ∈ ℝᵈ_unit vᵀ(Cₓ − α Cᵧ)v
Here v* is again an optimal direction, argmax selects a maximizer, and ℝᵈ_unit is the set of permitted vectors v. The transpose vᵀ stands on the left of the matrix expression. Cₓ and Cᵧ are the target and background covariance estimates, and α is the weight on the background term. For any fixed value of α, everything inside the parentheses is known before a direction is selected.
The authors give that matrix a short name.
C = Cₓ − α Cᵧ
C denotes the contrastive matrix at the chosen α. Its terms are the target covariance Cₓ and the background covariance Cᵧ multiplied by the contrast strength. Both terms are symmetric, as is their difference. The subtraction operates feature by feature in the covariance matrices. Each entry represents the contrast between corresponding covariance estimates.
Use eigenvectors as the new axes
An eigenvector is a direction that a matrix acts on by a scalar multiplication. The scalar is its eigenvalue. A symmetric matrix permits a basis of orthogonal eigenvectors, with perpendicular directions supplying distinct coordinates. For a unit eigenvector of C, the score in the preceding optimization equals its eigenvalue. More generally, the score for a unit vector is a weighted average of the eigenvalues, with weights determined by how much of the direction lies along each eigenvector. An eigenvector for the largest eigenvalue therefore attains the best score.
The methods section specifies the eigenvectors in descending order of eigenvalue. This detail matters because the difference of covariance matrices can have negative eigenvalues. A direction that receives a large negative score has background variance too large for its target variance under the chosen penalty. Ranking by absolute magnitude could put such a direction first. The schematic caption refers to singular vectors, while the optimization in the methods gives the operative ordering through signed eigenvalues.
The paper calls these directions contrastive principal components, or cPCs. The leading components span a subspace, a collection of directions represented by their linear combinations. The authors usually use two components for a view that can be plotted on a flat page. Each target observation receives a coordinate along each component. The resulting points express the target’s arrangement in the directions favored by the contrast. The procedure also supplies the weights defining those directions, which can be studied separately from the arrangement of points.
Eigenvector signs deserve care when reading those weights. Reversing the signs of all coefficients reverses the plotted axis and preserves the arrangement along it. What matters in a component image is which positions are weighted together, which receive opposing weights, and which contribute little. In the digit demonstration, the authors use this kind of inspection to connect the behavior of the scatterplot to the pixels used to produce it.
For a particular contrast strength, the authors describe the computational effort as essentially that of ordinary PCA. The central calculation in each case is an eigendecomposition of a feature-space matrix. The full exploratory procedure repeats that calculation across candidate strengths and then compares their subspaces. The claim about a single calculation is useful for understanding why a sweep can be practical and is narrower than a claim about the cost of the entire sweep.
Walk from target variance toward low background variance
At α = 0, the background term drops out and the leading eigenvectors are the ordinary target principal components. For small positive α, target variance can still have a strong influence on which directions lead. Increasing α puts more weight on low background variance. If a candidate has large background variance, the extra deduction can let a direction with less background spread overtake it, even if the second direction shows less spread in the target as well.
The authors describe an extreme case, α = ∞, using the background null space. This is the collection of directions in which the background has zero variance. If such directions are available, the limiting constraint excludes every direction that incurs a positive background penalty. Within the remaining space, the objective again chooses directions by their target variance. The authors describe this as restricting the target to the background null space and performing PCA there. This description has a useful geometric meaning when the null space contains directions in which the target can vary.
The practical sweep uses finite strengths. A moderately weighted view can retain variation that is present in both collections but is especially pronounced in the target. Under a much stronger contrast, that same variation might become hard to see. A series of plots can therefore have scientific value even when the preference for lower background variance is clear in the abstract. The investigator may care about a pattern that becomes visible at a particular balance, without knowing that balance in advance.
Reduce a sweep to a handful of different views
The default procedure considers 40 contrast values, logarithmically spaced from 0.1 to 1000. Logarithmic spacing spreads candidates across orders of magnitude. The authors report using this range for the experiments. Each candidate supplies a subspace from its leading cPCs. Many candidates can give closely related subspaces, so displaying the entire sweep could ask a reader to inspect essentially the same feature-space orientation repeatedly.
The authors use principal angles to compare the orientations. These angles describe how well directions inside one subspace can align with directions inside the other. This makes the comparison meaningful even when an axis changes sign or when the leading directions are expressed in a different basis within the same subspace. The object being compared is the space covered by the displayed axes. Two sets of axes can orient a plot differently while retaining the same underlying subspace.
The similarity used by the algorithm is the product of the cosines of the principal angles. The cosine gives high similarity for an angle close to alignment and falls as the alignment weakens. Combining the cosines rewards agreement across the subspace. The algorithm uses these similarities in spectral clustering, which groups candidates according to the pattern of affinities among them. For each group, a medoid represents it. A medoid is drawn from the actual candidates, so the associated contrast value already has a computed subspace that can be used to plot the target.
The selection criterion involves alignment among projections. It requires no digit identities, disease statuses, patient sample labels, or geographic labels to determine how well particular settings bring those groups into view. Scientific interpretation comes when the analyst examines the returned projections. The paper also allows specific α values for a closer look at regions of the sweep. The representative views organize that exploration around changes in the space used for the plot.
See the variance trade-off as a boundary
The paper gives a geometric account of the leading direction. Imagine collecting the two variances for every eligible direction in a single plot. The target variance provides the horizontal coordinate, and the background variance provides the vertical coordinate. The set of all attainable points is U.
U = {(λₓ(v), λᵧ(v)) : v ∈ ℝᵈ_unit}
U is the set described by the braces. Its elements are ordered pairs, with target variance λₓ(v) first and background variance λᵧ(v) second. The colon means the pairs are formed subject to the condition that follows. The notation v ∈ ℝᵈ_unit permits every real unit direction v in dimension d.
A move to the right gives more target spread, and a move down gives less background spread. If a direction exceeds another on target spread and also improves on background spread, the comparison is straightforward. Much of the interest lies in pairs for which improving one quantity costs something on the other. The authors describe the relevant lower-right boundary as analogous to a Pareto frontier, the collection of tradeoffs where improvement on one axis comes at a cost on the other. A direction is interesting here in terms of its variance pair, regardless of the kind of scientific pattern that gives rise to that pair.
For a positive finite contrast, a line containing points of equal objective value has the following slope in those coordinates.
slope = 1/α
The slope is the change in vertical background variance per change in horizontal target variance along a line of constant score. The number 1 is the numerator in the reciprocal, and α is the positive contrast strength. Sliding a line of this slope toward greater objective values eventually brings it to a supporting contact with the feasible set U. A contact point represents a variance pair selected by the leading cPC.
The paper illustrates this geometry with randomly generated target and background data. Its figure labels the selected directions with contrast strengths of 0.92 and 0.29 and gives the corresponding supporting-line slopes as 1.08 and 3.37. A stronger background penalty favors points lower on the variance plot. A weaker penalty favors points farther to the right. The direction of movement stated in the prose accompanying the theory appears reversed relative to the stated objective and axis definitions. The score and the supporting-line construction give the governing relationship.
The authors’ result connects the complete range of contrast strengths to the set of most contrastive directions. As α varies, the leading solutions recover the tradeoffs on the relevant boundary. This explains what the continuous sweep is capable of selecting in mathematical terms. The finite grid and the representatives chosen from it sample that family of views. The theorem is about the leading direction and the variance criterion. The plotted span of several leading components and the scientific labels used to read it are further parts of the application.
How sample estimates approach the population direction
Each covariance estimate is based on observed samples. Even with a fixed feature definition and a fixed contrast strength, changing which observations enter either collection can change the leading eigenvector. The authors analyze the relationship between the cPC estimated from samples and its population counterpart, defined by the covariances of the underlying populations. They give the following convergence rate under the assumptions of their supplementary analysis.
Oₚ(√(d / min(n, m)))
Oₚ denotes stochastic order, a statement about the size of the estimation error in probability. The dimension d counts features, n is the target sample size, and m is the background sample size. The function min takes the smaller of n and m. The quotient puts d over that smaller sample count, and √ denotes its square root.
The rate resembles the usual rate the authors cite for estimating a covariance eigenvector. The appearance of the smaller sample count reflects the need for information about both covariance matrices. An abundance of target observations still leaves uncertainty in the estimate used for the background penalty when the comparison is thin. The rate addresses an estimation question after the comparison has been defined. Whether the population direction itself represents a useful scientific contrast depends on which populations those matrices describe.
Experiments and results
What the paper measures in the demonstrations
The experiments ask what becomes visible when the same target measurements are displayed with ordinary principal components or with contrastive ones. The primary evidence comes from the arrangement of points, known sample or group identities, and, for the digit experiment, the weights of the first components. In the examples with categories, the labels make the plotted structure legible. In the ancestry example, the layout of the groups matters as well as their local concentration. The reported results are visual comparisons. The paper supplies no common numerical clustering score, classification accuracy, or held-out test result for these displays.
The numeric comparison below records the strength of the background penalty in the noisy-digit views. The “higher” direction refers to stronger contrast on this scale. The visual outcome is assessed separately in the paper’s scatterplots.
Background penalty in the noisy-digit experiment by projection setting
The contrastive display uses a positive background penalty and the ordinary display uses none.
The numbers
| System or setting | contrast parameter α |
|---|---|
| Target PCA | 0 |
| Contrastive PCA (this paper) | 2.0 |
Handwritten digits over grass
The authors built a target of 5,000 images by placing handwritten examples of 0 and 1 from MNIST over grass photographs from ImageNet. They selected photographs from the grass category, converted them to grayscale, and resized them to 100 × 100. They then took random 28 × 28 crops to match the digit images. This produces a target in which every observation contains an instance of the background variation and an instance of the foreground shape. The blend is constructed, giving the authors a known distinction to look for in the resulting coordinates.
The background data consist of grass images from the same category. The authors use different photographs for that collection from the ones contributing to the composite images. What the comparison can supply is an estimate of how grayscale pixels vary together across grass images. It has no information about which grass image was placed behind a particular digit. This construction lets the experiment check whether population-level resemblance in the background is sufficient to recover a useful contrast.
The target PCA plot uses the leading pair of components. Observations containing the different digits are difficult to distinguish in that view. With cPCA, the displayed contrast strength of 2.0 produces separate visible groups corresponding to 0 and 1. The point colors identify the digit for the reader. The covariance procedure chooses the coordinates from the composite and grass data, so that correspondence between the colors and the groups is evidence about the information the projection retained.
The authors also display the first ordinary and first contrastive components as images, locating each coefficient at the position of its pixel. Light areas carry more positive weights and dark areas more negative weights in the orientation shown. The first ordinary component emphasizes the image periphery and gives relatively less weight to parts of the center and bottom. This is consistent with a coordinate strongly affected by the grass. The contrastive component gives positive weight to positions characteristic of the handwritten 1 and negative weight to positions characteristic of the 0, with much of the remaining area contributing little.
Those weight images help connect the coordinates to the known construction. In a scatterplot alone, a reader could see that the categories are easier to distinguish but would have less information about which measurements are making them distinguishable. For the digit images, the weights lie on the same spatial grid as the foreground objects. The contrast is therefore visible both in how the target points arrange themselves and in where the component gets its information. This motivates the authors’ suggestion that such weights can help with feature selection or denoising.
Protein expression in mice exposed to shock
The mouse target contains protein expression measurements from animals that received shock therapy. The collection includes animals with and without Down syndrome. The analysis treats that status as unknown while finding the components, then uses it to judge the resulting view. The comparison collection comes from mice without shock exposure. The reason for that choice is that ordinary variation among animals is expected in both collections, while the comparison animals have had no exposure to the shock condition.
The leading PCA coordinates place the Down syndrome and other animals in broadly similar parts of the plot. The authors mention sex and age as possible contributors to large natural differences among mice. These are proposed explanations for the dominant variation. The plots assess how the recorded Down syndrome labels are distributed in the projected space. They leave the origins of the ordinary spread open.
The contrastive view shows groups that correspond much more closely to the Down syndrome distinction. One group corresponds to mice without the condition, and the other consists predominantly of mice with it. The description of the second group as predominantly Down syndrome is important to reading the result. A visual grouping with some mismatch still supports the aim of identifying structure for closer study. The experiment provides a picture of the organization of the measured animals under the chosen contrast.
The authors also describe a supplementary comparison with 8 other dimensionality reduction techniques. They report that none of those views separates the mouse groups as clearly as cPCA. The outcome is conveyed through the supplementary displays and the authors’ assessment of separation. There is no reported numerical margin by which the contrastive view leads. The strongest comparison is therefore the degree to which the plotted groups are distinguishable in this particular study.
Bone marrow cells before and after a transplant
The single-cell study uses RNA expression measurements from bone marrow mononuclear cells. Each plotted observation represents a cell, and cells from a collection taken before or after a transplant carry a shared sample label. The initial target pools samples from before and after a stem-cell transplant in a leukemia patient. The background consists of the corresponding kind of cell measurements from a healthy person. The authors expect ordinary diversity among bone marrow cells and some variation associated with experimental conditions to be represented in the healthy data.
Before applying either projection, the authors restrict the analysis to 500 genes with the highest dispersion in the target. Dispersion here means variance divided by mean. This step defines the features whose covariance will be compared. In particular, the ordinary and contrastive displays use the same feature-selection principle. The contrastive analysis can bring out different combinations of those genes while working within a feature space already chosen to favor target variability.
For the initial patient, PCA puts cells from the pre-transplant and post-transplant samples in similar distributions on the leading axes. The authors suggest that variability among cell types within the samples and variability in experimental conditions could occupy those axes. The contrastive plot shows the samples more distinctly. The healthy covariance gives the method a way to penalize directions in which bone marrow cells already show appreciable spread in the comparison, making other directions easier to inspect in the patient data.
The authors then add pre-transplant and post-transplant samples from a second patient, creating a target with four sample-defined cell populations. They retain the healthy background. The leading PCA plot leaves these populations difficult to distinguish. In the contrastive display, at least three of the populations show substantially stronger separation. The two post-transplant samples occupy more similar regions than the two pre-transplant samples, a relationship the authors point to as a hypothesis that could be tested. The supplementary material shows the samples separately to make their overlap easier to inspect.
That last observation makes the experiment about relationships among samples as well as the visibility of group boundaries. Once several sample distributions become distinguishable, their positions relative to each other can motivate a question of their own. Here the geometry suggests looking more closely at pre-transplant differences and post-transplant similarities. The cell projections are evidence for this question arising from the measurements. Establishing the biological origin or reproducibility of the similarity calls for a different form of analysis.
Fine-scale ancestry within Mexico
The ancestry experiment considers single nucleotide polymorphisms, or SNPs, which are differences at individual positions in the genome. The target has measurements from people associated with five Mexican states. The group labels are known, and the question concerns the relationship among those groups in an embedding, the low-dimensional arrangement of the observations. Useful structure could appear as people from the same state lying closer together or as a geographic ordering among the groups.
The paper explains that the balance of European and Native American ancestry can dominate the leading genetic variation in such data. PCA on the target produces a plot with little visually discernible state-associated structure. The authors describe a population-genetics practice of removing SNPs known to derive from European ancestry before applying PCA. That approach depends on knowing the origins of the variants and being able to distinguish the unwanted source of variation from the variation needed to study geography inside Mexico.
The contrastive analysis uses a background containing individuals from Mexico and Europe. The authors expect variation associated with European and Native American ancestry to dominate that broader collection. Penalizing its covariance contribution gives finer variation within the target a chance to occupy the plotted axes. The background for this analysis thus plays a different substantive role from the healthy cell sample or the unexposed mice. It deliberately spans a broad source of ancestry variation so that the contrast can give more space to differences at a narrower geographic scale.
In the resulting plot, individuals from the same state tend to appear closer together. The Sonoran group and the Mayan group from Yucatan lie farthest apart in the display, in agreement with their geographic separation. The other state groups, from Zacatecas, Guanajuato, and Guerrero, appear nearer each other in the embedding and are closer geographically in the comparison described by the authors. The paper includes a map alongside the comparison, letting readers relate the arrangement of projected observations to the locations of the groups.
The evidence concerns recognizable relationships at the scale of the display. The experiment gives neither a numerical distance-agreement measure nor an estimate of uncertainty around the relative positions. Its visual result is useful because the geographic labels allow the reader to ask a specific question of the point arrangement. Across the demonstrations, the authors use the same covariance criterion to support different readings of a plot. Digit identity supplies a known foreground distinction, mouse status supplies a biological grouping withheld during fitting, the cell samples supply both differences and overlap, and the ancestry groups supply a spatial relationship to examine.
What the ablations show
The paper has no systematic removal study of every algorithmic step. Its closest comparisons are the target-only PCA baseline, the alternative image background, the expansion of the cell target, and analyses of component weights and contrast strength.
What changes between the PCA and cPCA views
At zero contrast, the covariance calculation exactly recovers target PCA. The ordinary displays therefore show what the target variance criterion itself does with the measurements. The comparison with cPCA shows what changes when a background penalty affects the order of the available directions. It is especially informative in the digit experiment, where the two views use the same composite images and the authors also show the weights of the first ordinary and contrastive components.
The ordinary component devotes much of its weight to regions where grass can supply strong variation. The contrastive one emphasizes regions associated with distinguishing the shapes. Together with the visibly separated digit groups, this supports the explanation that the background term promotes feature combinations carrying the digit signal. It ties the change to a property of the coordinates themselves. The experiment leaves open how the outcome would vary across other choices of preprocessing or image construction, since those factors are outside this comparison.
The mouse comparison adds a broader check. An investigator might hope that an alternative dimensionality reduction method, by organizing the measurements differently, could make the protein groups visible. The supplementary views with other techniques give the authors a basis for assessing that possibility on the selected data. Their reported advantage for cPCA is a visual one. This comparison speaks to the value of supplying the control covariance in that case, with the strength of the conclusion bounded by the settings and displays examined.
Substitute a background with related covariance
The grass-only collection already establishes a degree of independence between the target construction and the background data. The paper takes a further step by describing what happens with sky images in the background. It reports similar results even though the nuisance content physically present in the target is still grass. The proposed explanation is that the two background collections have sufficiently similar covariance in the directions that matter to the contrast.
This is a comparison of covariance relevance across image categories. The semantic identity of the scene is only an indirect guide to whether it supplies the required feature relationships. Sky can be useful in this example if its variability across pixels identifies some of the same directions that grass would identify. The reported substitution supports flexibility in this particular setting. The experiment gives no scale for an acceptable mismatch and leaves the effect of substantially different covariance patterns unresolved.
Add target variation while retaining the comparison
The cell analysis compares a target derived from one patient with a target that includes an additional patient. The background remains the same healthy sample. The target covariance changes because the combined collection now contains differences among more samples, including between patients. The displayed result shows that the contrast can still expose several groups in the enlarged target. It also reveals a relation among groups that could only be examined once both patients’ measurements were included.
That relation is the proximity of the post-transplant samples alongside the greater visual distinction between the pre-transplant samples. Maximizing separation by sample label would have given similarity between two sets of cells an entirely different role. Here sample identity serves as an interpretive guide for coordinates based on variance. The expansion shows how the method can expose partial separation and overlap in the same view. It provides a comparison across target compositions while leaving sensitivity to a changed healthy reference as a separate empirical question.
What the parameter analysis establishes
The paper’s geometric example explains how changing α selects different leading directions. The automatic procedure addresses a related practical problem. Some stretches of the parameter grid can yield similar subspaces, and a collection of representatives gives the analyst access to geometrically different views with fewer plots to examine. The underlying comparison is between spaces spanned by the axes, so it can treat changes of signs or basis within a space appropriately.
The geometric result establishes the relationship between α and the variance frontier. The clustering of subspaces then supplies a way to sample the space of views. The paper illustrates the procedure and reports using automatically generated contrasts. It offers no separate numerical comparison of automatic selection with values chosen by an expert. Likewise, the supplementary kernel example shows an extension to nonlinear patterns, while the main comparisons illustrate the linear construction. The evidence for the background penalty, the motivation for selecting several views, and the reported nonlinear extension each address a different part of the method.
Limitations
Limits the authors state
The authors explicitly say that cPCA attaches no p-values or comparable significance quantities to the patterns it displays. A visible separation gives the analyst something specific to investigate. Its reliability can then be assessed with hypothesis testing or other analyses that use the knowledge appropriate to the data. This division matters particularly when several contrastive projections are offered. A plot can help specify a promising question about certain groups, while the evidential standard for answering that question remains the standard of the scientific study.
The paper identifies the background as a major influence on the result. Its usefulness rests on the investigator having a plausible collection that represents variation worth discounting. The authors allow some flexibility in how closely that collection matches the nuisance structure, as the grass and sky example illustrates. They also emphasize the quality of both covariance estimates. Equal sample sizes are immaterial to the definition because the estimates are formed independently. Adequate information about variation in each collection is the substantive requirement.
The authors position the method as a broadly available exploratory tool and acknowledge that expert-designed methods can work better in particular applications. A general covariance contrast provides a common operation for very different measurements. That broad applicability comes with a limited vocabulary for describing domain structure. The background choice and feature definition carry much of the knowledge specific to the scientific question.
Limits that follow from the setup
The contrast is conditional on the supplied comparison. If a background contains strong variation along a scientifically interesting direction, the formula penalizes that direction as well. If the background largely misses the unwanted variation that dominates the target, the nuisance direction can retain a high score. Both possibilities follow directly from the objective. The algorithm sees feature covariances and gives them weight according to α. Scientifically useful “enrichment” is therefore an interpretation of high target variance relative to a particular background, with no universal claim about which other populations exhibit the same pattern.
Changes in the feature representation also change the available contrasts. The cell example starts by making a choice about which genes enter the analysis. Each returned view is defined over those selected features. Its ability to represent a pattern depends on the features surviving that preprocessing and on their joint variation. Even given all selected measurements, a plot with only the leading axes captures a small part of the available directional structure. A group that remains obscure in a view may appear elsewhere in feature space or at a different strength of contrast.
The main method uses linear combinations of measured features. It favors structures that affect variance in such combinations. Groups that differ through a more complex arrangement can be hard to represent on those axes, and a subtle distinction can produce limited variance even when it is scientifically important. The supplementary kernel construction addresses the possibility of nonlinear contrastive structure. The main experiments provide little basis for judging how widely that extension improves the linear views. Similarly, the variance-frontier theorem concerns attainable tradeoffs for the leading direction under the stated objective. Group recovery is a further question.
Visual evaluation limits how precisely the experimental comparisons can be carried across datasets or settings. The digit groups, mouse groups, patient samples, and ancestry groups are interpreted against different kinds of external information. The authors give no common measure of how large an improvement the contrast delivers. The figures are well suited to showing what became visible in the selected examples. A numerical claim about the probability of recovering a meaningful group in a new collection would require a separate evaluation.
There is also a distinction between the interpretation of a projection and the cause of the variation it shows. A direction favored by the comparison can combine many features that respond to an assortment of biological and measurement processes. Its covariance score records the amount of spread in the two collections. In the transplant example, the similarities in the display motivate a question about how the patient samples relate after transplantation. The projection by itself leaves open the contribution of biological differences, the composition of the cell samples, and the measurement conditions. Those possibilities require evidence about the samples beyond where they lie on the cPC axes.
Finally, population estimation and scientific relevance place separate demands on the analysis. When the sample eigenvector estimates its population counterpart well, that is evidence about the stability of a direction for the chosen comparison. The convergence result is stated under assumptions and concerns that estimation problem. The direction can still describe something outside the substantive aim if the background was poorly chosen or if the representation gives high weight to other differences. Conversely, a plausible comparison can yield an uncertain sample direction when the measurements support an imprecise covariance estimate. Reading a cPCA result well involves keeping track of both what the comparison is meant to express and how securely its directional structure can be estimated.
What came after
A later work on localized, calibrated control of moral reasoning cites the paper. The citation establishes a connection across research areas, while the role of cPCA in the later method and experiments remains unspecified. The available information therefore supports attributing the citation and the later work’s subject, with the question of technical adoption left open. Where Paths Split (2026).
Cite
Cite as Abubakar Abid, Martin Jinye Zhang, Vivek Bagaria and James Zou. 2018. Exploring patterns enriched in a dataset with contrastive principal component analysis. Nature Communications.
@inproceedings{abid2018exploring,
title = {{Exploring patterns enriched in a dataset with contrastive principal component analysis}},
author = {Abubakar Abid, Martin Jinye Zhang, Vivek Bagaria and James Zou},
booktitle = {Nature Communications},
year = {2018},
doi = {10.1038/s41467-018-04608-8},
url = {https://doi.org/10.1038/s41467-018-04608-8}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/abid-2018-exploring-patterns-enriched-dataset-contrastive/