Guest User

Untitled

a guest
Jun 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #ph_labels are the labels
  2. unique = np.unique(ph_labels)
  3. num_pca = 6
  4. reduced_ph_features = np.zeros((features.shape[0], num_pca))
  5. for i in unique:
  6. from sklearn.decomposition import PCA
  7. pca = PCA(num_pca)
  8. indices = np.where(ph_labels == i)[0]
  9. reduced_ph_features[indices, :] = pca.fit_transform(features[indices, :])
Add Comment
Please, Sign In to add comment