liveBook · Manning

Correlation matrix

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

A symmetrical matrix containing pairwise correlations among a collection of variables or features.

A correlation matrix arranges pairwise correlations between numeric features in a symmetrical table. Visualizing it as a heatmap makes unusually strong relationships easier to spot. section 2.4.3

Use the matrix to investigate duplicated information and possible collinearity:

  • Inspect readable heatmaps when only a few features are involved. section 2.4.3
  • For wider datasets, list only correlations exceeding a chosen threshold. section 2.4.3
  • Investigate correlations above an absolute value of 0.98 to 0.99, including strong negative correlations. section 2.4.3
  • Decide whether to drop a collinear feature to reduce the dataset and avoid later learning or interpretability problems. section 2.4.3
import seaborn as sns
corr = data[numeric_feats].corr()
sns.heatmap(corr, cmap="Blues",annot=True)

Compute correlations for selected numeric features with pandas, then display the result as an annotated seaborn heatmap. section 2.4.3

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

How deep it goes
Explains matrix construction, visualization, thresholds, and feature-removal decisions; stops short of categorical association methods.
Examples
Demonstrates selected numeric features, an annotated heatmap, and correlations exceeding absolute thresholds near 0.98 to 0.99.
What it assumes
Assumes numeric features and pairwise correlation; distinguishes correlation-based analysis from categorical association analysis.
What you can do after
Diagnose with pandas and seaborn by visualizing numeric-feature correlations and identifying candidates for removal.
How it connects
Links bivariate correlation with collinearity, multicollinearity, feature selection, and learning-algorithm convergence.

Also explained in

Compare how 5 books explain correlation matrix →

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.