I'm interested in using logistic regression to classify opera singing (n=100 audiofiles) from non opera singing (n=300 audiofiles) (just an example). I have multiple features that I can use (i.e. MFCC, pitch, signal energy). I would like to use PCA to reduce dimensionality, which will drop the 'least important variables'. My question is, should I do my PCA on my whole dataset (but opera and non-opera)? Because if I do, wouldn't this drop the 'least important variables' for both opera and non-opera rather than drop the variables least important for identifying opera?
How to use principal component analysis for logistic regression
1.5k views Asked by sos.cott At
1
There are 1 answers
Related Questions in LOGISTIC-REGRESSION
- Error in eval(predvars, data, env) : object 'Juice_practice' not found when running binary logistic regression in r
- Limited Number of Beta Coefficients for 1000 predictors using glm() in R
- Non-numeric argument to binary operator, despite values being numeric
- fasttext embeddings in order to do logistic regression
- Generalized mixed effect logistic regression model and strange p values (maybe separation of data)?
- Predicting if a customer will do something at a specific time based on previous history
- How do I convert a character string to hms in R? (including hms above 24 hours)
- How to fix the problem "operands could not be broadcast together with shapes" on get_margeff in statsmodels with dummy=True?
- logistic regression implementation - loss is not converging and poor model results
- Printf changes the outcome the program
- Logistic Lasso on large gene dataset specifically through the Knockoff package in R
- Regressions performed by hand
- Logistic Regression - AttributeError: 'tuple' object has no attribute 'fit'
- ImportError: cannot import name '_gb_losses' from 'sklearn.ensemble' ; Error deploying ML python webapp to streamlit community cloud
- why is e used so much in the NN?
Related Questions in PCA
- How to use model.predict after PCA transformation in Python?
- Fix scatter plot in PCA
- R PCA: Why are some points in a biplot larger than others?
- Can you specify a rotation in h2o's PCA function?
- Principal Component Analysis and Clustering - Better Discrimination between Classes
- Covariance estimation using the Factor Model
- split sklearn's IncrementalPCA (ipca.transform) input, based on features instead of samples
- How to change the colors on fviz_contrib to match clusters/groups in R?
- My Principal components plotted using sklearn seems a bit rotated by some degrees. What have I missed?
- How to reshape the result of sklearn's IncrementalPCA (ipca.transform)
- Can the PC1 results from a PCA test be multiplied to the corresponding variable and added together to create a new variable column?
- Correlation matrix shrinkage causes matrix multiplication error for monte carlo simulation
- Searching for some individuals in a biplot in R
- TypeError: 'int' object is not iterable" and PCA Assertion Error in Python Clustering Function
- PCA with BioClim Rasters - R language
Related Questions in PRINCIPAL
- SpringBoot Injected Principal not null but SecurityContextHolder.getContext().getAuthentication() always null - Websocket
- How to mock a Principal object?
- Ktor OAuth, cant set User session when I have token
- KernelPCA explained variance is (99-100)% for all the features of the dataset
- I have 5 folders (each contain about 200 RGB images), I want to use "Principal Component Analysis" for image classification
- Principle Component Analysis, add a line to the 3d graph showing the first principal component
- How to change the role of a user in CustomUserDetails?
- How to update user data in Principal when changing his login?
- How to define custom principal class in Elytron WildFly 26.1?
- Can I access the current user in session statically in Quarkus?
- How to access java.security.Principal attributes inside Spring Boot controller?
- Is there a way of translating the importance of each feature into the observations in PCA?
- PCA with library psych, how to plot?
- How do I hide the "Cloudcommons" field for a specific group in the Hybris Backoffice search tree
- How to get Claims Principal in Azure Function running Node?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Short answer:
You must do your PCA on the whole data.
Not so short answer:
Long answer:
PCA does not remove the 'least important variables'. PCA is a dimensionality reduction algorithm that is going to find linear combinations of the input features that encode the same amount of information (inertia) using fewer coordinates.
So if your data has
N_Featsyou can think of PCA as a matrix of dimensionN_Feats x Projection_sizewhereProjection_size < N_Featsthat you multiply to your data to get a projection of lower dimensionThis implies that you need all your features(variables) to compute your projection.
If you think in terms of projections, it doesn't make sense to have 2 different projections for each class. Why? There are 2 reasons: