liveBook · Manning

Visualization

As explained in Outlier Detection in Python

A visualization is a visual representation of data designed to reveal distributions, relationships, or unusual observations.

Visualization represents data visually to reveal distributions, relationships, and unusual observations. For outlier detection, it is flexible and useful as an exploratory first step, but less precise and more subjective than statistical methods. section 2.1.5 section 2.3.2

Choose plots according to the feature types and dimensionality:

  • Plot numeric features with histograms and categorical features with bar or count plots. section 2.3.2 section 8.1.2
  • Use scatterplots for two numeric features, heatmaps for two categorical features, and boxplots for one categorical and one numeric feature. section 2.3.2
  • Inspect log-scaled views when distributions are strongly skewed or plausibly log-normal. section 2.1.5
  • Treat plots as a smoke test and debugging aid, not as the sole evaluation method for multidimensional detectors. section 8.3 section 8.8

Flagged values in one-dimensional plots

Plot a histogram of feature A and draw vertical lines for rows marked as outliers. This can clarify extreme one-dimensional values, but multivariate outliers may look ordinary in every individual histogram. section 8.1.2

Comparing detector results in a feature pair

Plot Diameter against Shell_weight in the abalone data and compare the top-ranked points from several detectors. A point outside the main cluster may be flagged by LOF and GMM but not by others, while points inside the cluster may be anomalous in another feature space. section 8.3.1

Figure 8.7 2D plots of two features, Diameter and Shell_weight from the abalone dataset, tested with eight detectors. There are some points that appear to be the strongest outliers, including a point outside the main cluster (circled), which is flagged only by LOF and GMM. In addition, the largest point in the Shell_weight dimension, at the top of the plot, which is flagged only by OCSVM, GMM, and KDE. Some detectors, including LOF, GMM, and KDE, flag points within the main cluster, which may be legitimate as they may be outliers in other spaces.

Compare detector flags against visible structure in a two-dimensional feature space. section 8.3.1

How Outlier Detection in Python covers it

How deep it goes
Explains plot selection and interpretation through one- and two-dimensional examples, but stops short of reliably explaining higher-dimensional anomalies.
Examples
Uses OpenML distributions, eucalyptus feature pairs, detector-score histograms, baseball statistics, and abalone measurements.
What it assumes
Assumes basic feature types and detector scores, while reinforcing exploratory inspection before selecting or evaluating detection methods.
What you can do after
Diagnose/debug with it by checking detector flags against one- and two-dimensional distributions and visible feature relationships.
How it connects
Connects exploratory data analysis, outlier detection, histograms, scatterplots, heatmaps, boxplots, and detector evaluation.

Also explained in

Compare how 16 books explain visualization →

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.