Principal component classifier

We will first try to build an anomaly detection model using principal components, similar to what we did in Chapter 9, Cyber Attack Detection. For training and testing a PCC model, we wrote a helper function, named BuildPCAClassifier. The detailed code for this helper function can be found at the following repo: https://github.com/yoonhwang/c-sharp-machine-learning/blob/master/ch.10/Modeling.cs. Let's take a look at this helper function step by step.

You will see the following lines of code when you look at the code for the BuildPCAClassifier method:

// First 13 components explain about 50% of the varianceint numComponents = 13;string[] cols = featuresDF.ColumnKeys.Where((x, i) => i < numComponents).ToArray(); ...

Get C# Machine Learning Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.