liveBook · Manning

Correlation

As explained in Outlier Detection in Python

Correlation is a measure of statistical association between paired numerical quantities, such as outputs from different detectors.

Correlation measures statistical association between paired numerical quantities. In outlier detection, it compares detector scores to assess whether methods agree, especially about records ranked as outliers rather than ordinary inliers. section 8.4

Pearson correlation measures linear association between raw scores, while Spearman correlation measures Pearson correlation between score ranks. Spearman is often more useful because detectors can produce differently distributed scores with strong rank agreement but weak linear agreement. section 8.4

Apply correlation carefully when comparing outlier detectors:

  • Exclude most low scores before calculating agreement; differences among records that every detector treats as inliers are usually uninformative. section 8.4 section 8.8
  • Retain rows where at least one detector assigns a top-percentile score, then compare rankings or cleaned scores with Spearman correlation. section 8.4
  • Use correlation to seek diversity in ensembles, but balance low correlation against accuracy because a weak detector may appear diverse simply because it performs poorly. section 14.4.5 section 14.3.1

Comparing detector outputs

On the abalone dataset, several PyOD detectors produce scores that can be ranked and filtered to their highest values before creating a Spearman-correlation heatmap. Many detectors may correlate strongly without agreeing perfectly; LOF and LDOF can differ noticeably from the others.

How Outlier Detection in Python covers it

How deep it goes
Explains Pearson and Spearman measures, score filtering, ranking, and ensemble trade-offs, but does not derive correlation mathematically.
Examples
Uses abalone detector scores, top-score heatmaps, rank filtering, and PCA-transformed synthetic outliers as concrete examples.
What it assumes
Assumes paired detector scores and basic outlier-detection concepts while distinguishing Pearson and Spearman correlation explicitly.
What you can do after
Evaluate detector agreement with rank correlations and select more diverse ensembles without treating low correlation as sufficient evidence of quality.
How it connects
Connects correlation with outlier detection, Spearman correlation, Pearson correlation, detector ensembles, PCA, and Mahalanobis distance.

Also explained in

Compare how 16 books explain correlation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.