liveBook · Manning

Correlation

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

Bivariate correlation is a statistical measure of association between two variables or features.

Correlation measures the association between two variables or features. In tabular-data work, bivariate correlation compares numeric features one pair at a time, making it useful for finding duplicated or highly similar signals before modeling. section 2.2.2 section 2.4.3

Arrange pairwise correlations in a symmetric correlation matrix and inspect it as a heatmap when there are few features. For wider datasets, list only pairs above a chosen absolute threshold. Values near 0.98–0.99, including negative values approaching −1, flag potential collinearity; 0.90–0.95 can reveal features with little unique contribution. section 2.2.2 section 2.4.3

Use correlation as a feature-review step:

  • Investigate highly correlated pairs to understand why they overlap, then choose which feature to retain using target association, data quality, and domain knowledge. section 2.2.2 section 2.4.3
  • Distinguish pairwise correlation from variance inflation factor (VIF): VIF assesses a feature against all other features, while correlation identifies the specific related pairs. section 2.2.2
  • Check linear-regression inputs for strong feature-target Pearson correlation, while recognizing that correlated predictors can make coefficient-based explanations misleading. section 4.3.1 section 4.3.1

Screening numeric features

Create a correlation matrix with data[numeric_feats].corr() and plot it with a seaborn heatmap. In a synthetic dataset augmented with near-duplicate columns, pairwise screening above 0.90 identifies feature pairs with correlations from 0.947 to 0.966. section 2.2.2 section 2.4.3

import seaborn as sns
corr = data[numeric_feats].corr()
sns.heatmap(corr, cmap="Blues",annot=True)

Use the listing to compute and visualize a numeric-feature correlation matrix before deciding which highly collinear features warrant review. section 2.4.3

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Explains pairwise matrices, thresholds, and feature-removal decisions, while contrasting correlation with broader VIF analysis.
Examples
Demonstrates synthetic near-duplicate numeric features and a pandas correlation-matrix seaborn heatmap.
What it assumes
Assumes numeric tabular features and introduces their pairwise comparison through correlation matrices.
What you can do after
Apply it via pandas and seaborn to flag correlated numeric-feature pairs for investigation and possible removal.
How it connects
Connects correlation to collinearity, multicollinearity, variance inflation factor, feature selection, and linear regression.

Also explained in

Compare how 16 books explain correlation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.