O'Reilly logo

C# Machine Learning Projects by Yoon Hyup Hwang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Fitting a PCA

We are now ready to fit a PCA using the non-fraudulent credit card data. Similar to what we did in Chapter 9Cyber Attack Detection, we are going to use the following code to fit a PCA:

var pca = new PrincipalComponentAnalysis(    PrincipalComponentMethod.Standardize);pca.Learn(data);

As you can see from this code, we are using the PrincipalComponentAnalysis class in the Accord.NET framework to train a PCA. One more thing to note here is how we used PrincipalComponentMethod.Standardize. Since PCA is sensitive to the scales of the features, we are standardizing the feature values first and then fitting a PCA. Using this trained PCA, we can transform the whole data that contains both fraudulent and non-fraudulent transactions. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required