liveBook · Manning

Principal component analysis

As explained in Cyber Threat Hunting

Principal component analysis is a dimensionality-reduction method that projects data onto orthogonal components capturing decreasing amounts of variation.

Principal component analysis (PCA) reduces dimensionality while preserving as much variance as possible. It combines correlated features into fewer, independent principal components that retain the most important information. section 9.2.5

Apply PCA through a repeatable preparation and selection workflow:

  • Split labeled data into training and testing subsets, beginning with an 80–20 split, and check class balance. section 9.2.5
  • Scale training features to mean zero and standard deviation one with StandardScaler before applying PCA. section 9.2.5

Four-component projection

Setting PCA(n_components=4) transforms X_train_scaled into X_train_pca with columns PC1 through PC4; PC1 and PC2 or PC3 and PC4 can then be plotted by class.

How Cyber Threat Hunting covers it

How deep it goes
Explains the definition and workflow through scaling, variance plotting, transformation, and visualization without deriving PCA mathematically.
Examples
Demonstrates PCA with X_train_scaled, four components, cumulative-variance plots, and class-colored plots of PC pairs.
What it assumes
Assumes labeled feature data and train-test preparation, while teaching scaling and PCA application within that workflow.
What you can do after
Apply it via scikit-learn to scale features, select component counts, transform training data, and visualize component relationships.
How it connects
Connects dimensionality reduction with correlated features, feature scaling, train-test splitting, class balance, and explained variance.

Also explained in

Compare how 10 books explain principal component analysis →

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.