Answers for "Principal component analysis"

R
1

principal component analysis in r

library(FactoMineR)
library(factoextra)
res.pca = FactoMineR::PCA(X, scale.unit = TRUE, ncp = 5, graph = TRUE)
factoextra::fviz_eig(res.pca, addlabels = TRUE, ylim = c(0, 50))
Posted by: Guest on October-22-2020
3

pca

#if required,do pca 1st 
#then outliers removal then skewness removal

from sklearn.decomposition import PCA
pca=PCA(n_components=20)
pca.fit(df)
x_pca=pca.transform(df)
print(x_pca.shape)
x_pca20=pd.DataFrame(data=x_pca)
x_pca20
Posted by: Guest on August-11-2020

Browse Popular Code Answers by Language