How many principal components should I choose for PCA?2019 Community Moderator ElectionHow do I use principal component analysis in supervised machine learning classification problems?Using Principal Component Analysis (PCA) for feature reduction (HOG-PCA)Principal component analysis and feature reductionsHow to use principal component analysis (PCA) to speed up detection?Correspondence between PCA principal components and the original variablesPrincipal Component Analysis in Python intrinsic dimension map to feature names?Using PCA on test set which has dimensionality less than number of principal componentsFinding original features' effect to the principal components used as inputs in Kernel PCAPCA analysis considering N-less relevant componentsHow to select components instead of projecting them?
How could a female member of a species produce eggs unto death?
What is this large pipe coming out of my roof?
Life insurance that covers only simultaneous/dual deaths
Why are there 40 737 Max planes in flight when they have been grounded as not airworthy?
Does this AnyDice function accurately calculate the number of ogres you make unconcious with three 4th-level castings of Sleep?
Making a sword in the stone, in a medieval world without magic
Did CPM support custom hardware using device drivers?
Does this property of comaximal ideals always holds?
Could the Saturn V actually have launched astronauts around Venus?
Calculus II Professor will not accept my correct integral evaluation that uses a different method, should I bring this up further?
Why doesn't the EU now just force the UK to choose between referendum and no-deal?
It's a yearly task, alright
What options are left, if Britain cannot decide?
Professor being mistaken for a grad student
Rejected in 4th interview round citing insufficient years of experience
What has been your most complicated TikZ drawing?
Employee lack of ownership
Will a pinhole camera work with instant film?
How to deal with taxi scam when on vacation?
How could a scammer know the apps on my phone / iTunes account?
Is it possible / allowed to upcast ritual spells?
How do I hide Chekhov's Gun?
Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?
How to deal with a cynical class?
How many principal components should I choose for PCA?
2019 Community Moderator ElectionHow do I use principal component analysis in supervised machine learning classification problems?Using Principal Component Analysis (PCA) for feature reduction (HOG-PCA)Principal component analysis and feature reductionsHow to use principal component analysis (PCA) to speed up detection?Correspondence between PCA principal components and the original variablesPrincipal Component Analysis in Python intrinsic dimension map to feature names?Using PCA on test set which has dimensionality less than number of principal componentsFinding original features' effect to the principal components used as inputs in Kernel PCAPCA analysis considering N-less relevant componentsHow to select components instead of projecting them?
I have a dataframe with few categorical and numerical features. To that I've concatenated my BoW(CountVectorizer) of text column which resulted in more than 56,000 features. So I'm considering to do PCA for reducing number of features.
I think choosing correct number of principal components is crucial here but I'm confused on how many n_components
to consider here?
machine-learning nlp pca svd
add a comment |
I have a dataframe with few categorical and numerical features. To that I've concatenated my BoW(CountVectorizer) of text column which resulted in more than 56,000 features. So I'm considering to do PCA for reducing number of features.
I think choosing correct number of principal components is crucial here but I'm confused on how many n_components
to consider here?
machine-learning nlp pca svd
1
Great question!
– theantomc
Mar 9 at 10:43
add a comment |
I have a dataframe with few categorical and numerical features. To that I've concatenated my BoW(CountVectorizer) of text column which resulted in more than 56,000 features. So I'm considering to do PCA for reducing number of features.
I think choosing correct number of principal components is crucial here but I'm confused on how many n_components
to consider here?
machine-learning nlp pca svd
I have a dataframe with few categorical and numerical features. To that I've concatenated my BoW(CountVectorizer) of text column which resulted in more than 56,000 features. So I'm considering to do PCA for reducing number of features.
I think choosing correct number of principal components is crucial here but I'm confused on how many n_components
to consider here?
machine-learning nlp pca svd
machine-learning nlp pca svd
edited Mar 7 at 12:41
user214
asked Mar 7 at 12:30
user214user214
461115
461115
1
Great question!
– theantomc
Mar 9 at 10:43
add a comment |
1
Great question!
– theantomc
Mar 9 at 10:43
1
1
Great question!
– theantomc
Mar 9 at 10:43
Great question!
– theantomc
Mar 9 at 10:43
add a comment |
1 Answer
1
active
oldest
votes
You can plot a graph with the top k components and the variance of the k components.Choose k based on the variance contained in those components.95% or above would be ideal.
Yoshitha, I'm doing a two class classification task and I'm training my model using KNN. The time complexity of KNN is really high for high dimensional data. For 95% variance I may have to choose more number of components thereby increasing dimensions. Is it mandatory to select 95% for every scenario ?
– user214
Mar 7 at 13:18
It is not needed that you have 95%. Check the graph and you can select the k based on the steep of the curve. If there is sudden drop in the variance somewhere, choose k just before the sudden drop. On top of it, visualise the data and make sure that you capture enough information from data with the k components.
– Yoshitha Penaganti
Mar 8 at 6:06
can you check my variance plot. This is the image. What do you suggest here? How many components should I choose?
– user214
Mar 8 at 9:07
1
It seems like you have to take number of components atleast 500.
– Yoshitha Penaganti
Mar 8 at 11:23
I was also thinking the same. After 500 components increase in variance is less. I'll experiment and see. Thank you :)
– user214
Mar 8 at 11:33
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043860%2fhow-many-principal-components-should-i-choose-for-pca%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can plot a graph with the top k components and the variance of the k components.Choose k based on the variance contained in those components.95% or above would be ideal.
Yoshitha, I'm doing a two class classification task and I'm training my model using KNN. The time complexity of KNN is really high for high dimensional data. For 95% variance I may have to choose more number of components thereby increasing dimensions. Is it mandatory to select 95% for every scenario ?
– user214
Mar 7 at 13:18
It is not needed that you have 95%. Check the graph and you can select the k based on the steep of the curve. If there is sudden drop in the variance somewhere, choose k just before the sudden drop. On top of it, visualise the data and make sure that you capture enough information from data with the k components.
– Yoshitha Penaganti
Mar 8 at 6:06
can you check my variance plot. This is the image. What do you suggest here? How many components should I choose?
– user214
Mar 8 at 9:07
1
It seems like you have to take number of components atleast 500.
– Yoshitha Penaganti
Mar 8 at 11:23
I was also thinking the same. After 500 components increase in variance is less. I'll experiment and see. Thank you :)
– user214
Mar 8 at 11:33
|
show 1 more comment
You can plot a graph with the top k components and the variance of the k components.Choose k based on the variance contained in those components.95% or above would be ideal.
Yoshitha, I'm doing a two class classification task and I'm training my model using KNN. The time complexity of KNN is really high for high dimensional data. For 95% variance I may have to choose more number of components thereby increasing dimensions. Is it mandatory to select 95% for every scenario ?
– user214
Mar 7 at 13:18
It is not needed that you have 95%. Check the graph and you can select the k based on the steep of the curve. If there is sudden drop in the variance somewhere, choose k just before the sudden drop. On top of it, visualise the data and make sure that you capture enough information from data with the k components.
– Yoshitha Penaganti
Mar 8 at 6:06
can you check my variance plot. This is the image. What do you suggest here? How many components should I choose?
– user214
Mar 8 at 9:07
1
It seems like you have to take number of components atleast 500.
– Yoshitha Penaganti
Mar 8 at 11:23
I was also thinking the same. After 500 components increase in variance is less. I'll experiment and see. Thank you :)
– user214
Mar 8 at 11:33
|
show 1 more comment
You can plot a graph with the top k components and the variance of the k components.Choose k based on the variance contained in those components.95% or above would be ideal.
You can plot a graph with the top k components and the variance of the k components.Choose k based on the variance contained in those components.95% or above would be ideal.
answered Mar 7 at 12:45
Yoshitha PenagantiYoshitha Penaganti
24814
24814
Yoshitha, I'm doing a two class classification task and I'm training my model using KNN. The time complexity of KNN is really high for high dimensional data. For 95% variance I may have to choose more number of components thereby increasing dimensions. Is it mandatory to select 95% for every scenario ?
– user214
Mar 7 at 13:18
It is not needed that you have 95%. Check the graph and you can select the k based on the steep of the curve. If there is sudden drop in the variance somewhere, choose k just before the sudden drop. On top of it, visualise the data and make sure that you capture enough information from data with the k components.
– Yoshitha Penaganti
Mar 8 at 6:06
can you check my variance plot. This is the image. What do you suggest here? How many components should I choose?
– user214
Mar 8 at 9:07
1
It seems like you have to take number of components atleast 500.
– Yoshitha Penaganti
Mar 8 at 11:23
I was also thinking the same. After 500 components increase in variance is less. I'll experiment and see. Thank you :)
– user214
Mar 8 at 11:33
|
show 1 more comment
Yoshitha, I'm doing a two class classification task and I'm training my model using KNN. The time complexity of KNN is really high for high dimensional data. For 95% variance I may have to choose more number of components thereby increasing dimensions. Is it mandatory to select 95% for every scenario ?
– user214
Mar 7 at 13:18
It is not needed that you have 95%. Check the graph and you can select the k based on the steep of the curve. If there is sudden drop in the variance somewhere, choose k just before the sudden drop. On top of it, visualise the data and make sure that you capture enough information from data with the k components.
– Yoshitha Penaganti
Mar 8 at 6:06
can you check my variance plot. This is the image. What do you suggest here? How many components should I choose?
– user214
Mar 8 at 9:07
1
It seems like you have to take number of components atleast 500.
– Yoshitha Penaganti
Mar 8 at 11:23
I was also thinking the same. After 500 components increase in variance is less. I'll experiment and see. Thank you :)
– user214
Mar 8 at 11:33
Yoshitha, I'm doing a two class classification task and I'm training my model using KNN. The time complexity of KNN is really high for high dimensional data. For 95% variance I may have to choose more number of components thereby increasing dimensions. Is it mandatory to select 95% for every scenario ?
– user214
Mar 7 at 13:18
Yoshitha, I'm doing a two class classification task and I'm training my model using KNN. The time complexity of KNN is really high for high dimensional data. For 95% variance I may have to choose more number of components thereby increasing dimensions. Is it mandatory to select 95% for every scenario ?
– user214
Mar 7 at 13:18
It is not needed that you have 95%. Check the graph and you can select the k based on the steep of the curve. If there is sudden drop in the variance somewhere, choose k just before the sudden drop. On top of it, visualise the data and make sure that you capture enough information from data with the k components.
– Yoshitha Penaganti
Mar 8 at 6:06
It is not needed that you have 95%. Check the graph and you can select the k based on the steep of the curve. If there is sudden drop in the variance somewhere, choose k just before the sudden drop. On top of it, visualise the data and make sure that you capture enough information from data with the k components.
– Yoshitha Penaganti
Mar 8 at 6:06
can you check my variance plot. This is the image. What do you suggest here? How many components should I choose?
– user214
Mar 8 at 9:07
can you check my variance plot. This is the image. What do you suggest here? How many components should I choose?
– user214
Mar 8 at 9:07
1
1
It seems like you have to take number of components atleast 500.
– Yoshitha Penaganti
Mar 8 at 11:23
It seems like you have to take number of components atleast 500.
– Yoshitha Penaganti
Mar 8 at 11:23
I was also thinking the same. After 500 components increase in variance is less. I'll experiment and see. Thank you :)
– user214
Mar 8 at 11:33
I was also thinking the same. After 500 components increase in variance is less. I'll experiment and see. Thank you :)
– user214
Mar 8 at 11:33
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043860%2fhow-many-principal-components-should-i-choose-for-pca%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Great question!
– theantomc
Mar 9 at 10:43