Instantly share code, notes, and snippets.

Embed
What would you like to do?
from sklearn.decomposition import RandomizedPCA
from sklearn.preprocessing import StandardScaler
pca = RandomizedPCA(n_components=10)
std_scaler = StandardScaler()
X_train, X_test, y_train, y_test = train_test_split(data, labels, test_size=0.1)
X_train = pca.fit_transform(X_train)
X_test = pca.transform(X_test)
X_train = std_scaler.fit_transform(X_train)
X_test = std_scaler.transform(X_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment