PCA Reconstruction: statsmodels vs sklearn

  • Thread starter Shreyas Fadnavis
  • Start date
S

Shreyas Fadnavis

Guest
I am trying to move my PCA model from sklearn to statmodels.

Using sklearn, I can reconstruct my data in the following manner:

# reconstruction using 2 principal components
pca = PCA(n_components=2)
pca.fit(X)

# reconstruct the data
X_reconst = np.dot(pca.transform(X)[:,:2], pca.components_[:2,:])


What would be the equivalent of doing the same in statsmodels? The API and nomenclature seem to be quite different.

Thanks in advance!

Continue reading...
 
Top