1
$\begingroup$

I am reading this:

https://towardsdatascience.com/pca-using-python-scikit-learn-e653f8989e60

This is performing PCA before performing a logistic regression (in Python). I am not fluent in Python (I am using Matlab).

My questions are regarding the mathematical side of the process being performed.

I have taken the pca of my data sets, and found that I have 95% of the variability in the first three principal components.

I do not understand (from the link above) what is being trained/what is being done to the original data to train the logistic regression.

Here are my specific questions:

  1. Given that my first three principal components account for 95% of the variability of the data, what do I do with it? Do I transform the data? How do I use the loadings to train the logistic regression?

  2. Can someone please give a mathematical supplement/lecture regarding this procedure?

Thanks

$\endgroup$

1 Answer 1

2
$\begingroup$

Intuitively you can think the three component as the projection of original data(input data matrix X) to lower dimensions. Or you can think like the original data is transformed to lower dimensions.

  1. Once you got the components keep aside the original data. Just use the three components you got instead of your original data(input data matrix X) in training the model. I hope you have no doubt on training logistic regression.

  2. This is the best resource so far I encountered for PCA.

$\endgroup$
2
  • $\begingroup$ Thank you for your answers. But this is the part I understand. PCA is 'rewriting' into lower dimensions as a linear combination of the original variables. My question is: what will happen to my data? Of course I wont be training my original data because otherwise, why perform PCA to begin with, right? So will be written in place of the old data? Do I transform them in terms of the loadings? And if so, how to? $\endgroup$
    – cgo
    Commented Apr 8, 2020 at 10:22
  • $\begingroup$ Sorry, I didn't get you. Can you please be more clear? $\endgroup$ Commented Apr 8, 2020 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.