Created
October 4, 2018 05:05
-
-
Save aelnonym/d6c2eecf331375f03f4fe3f21e5f1090 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.preprocessing import StandardScaler | |
| from sklearn.decomposition import PCA | |
| # Escalando com SciKitLearn---------------------------------------- | |
| scaler = StandardScaler() | |
| scaler.fit(X) # Fit on training set only. | |
| # Apply transform to both the training set and the test set. | |
| X = scaler.transform(X) | |
| x_test = scaler.transform(x_test) | |
| # Aplicando PCA | |
| pca = PCA(.95) # Variancia .95 | |
| pca.fit(X) | |
| X = pca.transform(X) | |
| x_test = pca.transform(x_test) | |
| # Fim escalamento/ redução de dimensionalidade--------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment