Notes

Pearson Correlation

Pearson correlation is a quick way to describe how tightly two numbers move together in a straight-line pattern. If one tends to go up when the other goes up, it’s positive; if one goes up while the other goes down, it’s negative.

What it measures (and what it doesn’t)
Technically, Pearson correlation (often written as r) measures the strength and direction of a linear relationship between two variables. It ranges from -1 to +1:

  • r = +1: perfect increasing straight-line relationship
  • r = 0: no linear relationship (but a curved relationship could still exist)
  • r = -1: perfect decreasing straight-line relationship

Under the hood, it’s a standardized version of covariance: it divides covariance by the product of the variables’ standard deviations, making it unitless and comparable across scales.

Intuition with everyday examples
Think of it as “how well a straight line would summarize the co-movement.” For example:

  • House size vs. price: often a positive Pearson correlation (bigger homes tend to cost more).
  • Hours studied vs. exam score: typically positive, though it may flatten at high hours (nonlinearity can reduce r).
  • Outdoor temperature vs. heating bill: often negative (warmer weather, lower heating costs).

Why it matters in AI/ML
Pearson correlation shows up constantly in ML workflows:

  • Feature screening: quickly spotting features linearly related to a target.
  • Multicollinearity checks: highly correlated features can make linear models unstable and harder to interpret.
  • Similarity measures: correlation-based similarity is used in areas like recommender systems and time-series comparison.

Important caveats: correlation is not causation, and outliers can dramatically inflate or flip r.

Pearson Correlation is a standardized measure of linear association between two numeric variables, defined as covariance divided by the product of their standard deviations. It ranges from −1 (perfect negative linear relationship) to +1 (perfect positive), with 0 indicating no linear relationship. In AI/ML, it is used for exploratory analysis and feature selection to detect redundant predictors. Example: correlating a feature with the target to screen for linear signal.

Imagine you’re watching two things change over time, like how much you study and your test score. If more studying usually goes with higher scores, they “move together.” Pearson correlation is a simple number that describes how strongly two numeric things move together in a straight-line way.

It ranges from -1 to +1: +1 means they rise and fall together perfectly, -1 means one goes up when the other goes down perfectly, and 0 means no clear straight-line relationship. In AI and machine learning, it’s often used to quickly spot relationships between features (inputs) and outcomes, or between pairs of features.