liveBook · Manning

Seaborn

As explained in Cyber Threat Hunting

Seaborn is a Python library for creating statistical graphics, built on and integrated with matplotlib and pandas.

Seaborn is a Python data-visualization library for drawing appealing, informative statistical graphics. Built on matplotlib and closely integrated with pandas, it is useful for exploring structured data during analysis. section 8.1.8

A practical correlation-analysis workflow uses seaborn to:

  • Plot a pairwise Pearson-correlation heat map from a numeric-only data set. section 8.1.6 section 8.1.8
  • Annotate correlation scores and use a grayscale color map to expose strong positive, negative, and inverse relationships. section 8.1.8
  • Support feature selection by revealing redundant fields before modeling. section 8.1.6 section 8.1.8

Feature-correlation heat map

After converting categorical app values to numeric indicators, plot df_features_one_hot_enc.corr(method='pearson') with sns.heatmap(..., annot=True, cmap='gray'). A score of 0.75 between bytes and bytes_diff supports dropping bytes_diff; a score of −0.52 between app_windows_azure and count1 indicates an inverse relationship to evaluate. section 8.1.6 section 8.1.8

Listing 8.11 Generating pairwise correlation heat map for df_features_one_hot_enc
import matplotlib.pyplot as plt                                  #1
import seaborn as sns                                            #2
 
plt.figure(figsize=(16,9))                                       #3
sns.heatmap(df_features_one_hot_enc.corr(method='pearson'),\
    annot=True, cmap='gray')                                     #4

Use the listing to reproduce the annotated pairwise correlation heat map with matplotlib and seaborn. section 8.1.8

How Cyber Threat Hunting covers it

How deep it goes
Demonstrates annotated Pearson heat maps and interprets correlations for feature selection, without detailing seaborn internals.
Examples
Uses one-hot-encoded network features, grayscale heat maps, annotated scores, and correlated-column removal.
What it assumes
Assumes Python data analysis with pandas and matplotlib, while requiring numeric fields and installation before import.
What you can do after
Apply it via matplotlib to plot and interpret annotated correlation heat maps for feature-selection decisions.
How it connects
Connects statistical graphics with matplotlib, pandas, Pearson correlation, heat maps, and feature selection.

Also explained in

Compare how 3 books explain seaborn →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Cyber Threat Hunting. The section links point to the parts of the book it draws on.