pca

How to find best fit line using PCA in Python?

How to find best fit line using PCA in Python? Question: I have this code that does it using SVD. But I want to know how to do the same using PCA. Online all I can find is that they are related, etc, but not sure how they are related and how they are different …

Total answers: 2

How do I solve an import issue with numpy in scikit.decomposition.PCA?

How do I solve an import issue with numpy in scikit.decomposition.PCA? Question: I was trying to use the scikit.decomposition.PCA package and I couldn’t even import it. import numpy as np from sklearn.decomposition import PCA I’ve upgraded both of np and scikit, but the error seems to be w/in scikit, what should I do? *Note: Using …

Total answers: 1

Mean centering before PCA

Mean centering before PCA Question: I am unsure if this kind of question (related to PCA) is acceptable here or not. However, it is suggested to do MEAN CENTER before PCA, as known. In fact, I have 2 different classes (Each different class has different participants.). My aim is to distinguish and classify those 2 …

Total answers: 3

Plot Mahalanobis distance as ellipse for PCA is missing part of circle edge

Plot Mahalanobis distance as ellipse for PCA is missing part of circle edge Question: I am working creating a PCA combined with a Mahalanobis distance function to remove any outliers detected from the PCA transformation. I have come across this article which uses R: Mahalanobis output in R. However, how do I implement the Mahalanobis …

Total answers: 1

Memory requirement for PCA/kPCA

Memory requirement for PCA/kPCA Question: Is there a way to know exactly how much memory I will need to do PCA/kPCA in Python? For example, if I have a matrix of N rows and M columns: What memory will I need if N = 100, 10000, 100000? And does M have an effect on the …

Total answers: 1

Make available .best_params_ after pipeline

Make available .best_params_ after pipeline Question: How to go about making available the clf.best_params_ after carrying a pipeline? For the code I have below, I get an: AttributeError: ‘GridSearchCV’ object has no attribute ‘best_params_‘ Here is my code: from sklearn.datasets import make_classification import numpy as np from sklearn import metrics from sklearn.metrics import accuracy_score from …

Total answers: 1

Am I interpreting K-means results correctly?

Am I interpreting K-means results correctly? Question: I have implemented k-means elbow plot to find the optimum K for my data (after doing PCA). I have gotten the elbow plot shown below. My question is: I think the optimum K is 3 in my case (this is where a sudden drop occurs/point of inflection)? But …

Total answers: 1

How to un-standardize PCA reconstructions using StandardScaler inverse?

How to un-standardize PCA reconstructions using StandardScaler inverse? Question: I am trying to run a PCA analysis on ocean temperature data using sklearn. First I use StandardScaler to standardize the data, then I run the PCA and create the reconstructions. I can get code to work fine up until that point. However, I cannot figure …

Total answers: 1