Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ph_labels are the labels
- unique = np.unique(ph_labels)
- num_pca = 6
- reduced_ph_features = np.zeros((features.shape[0], num_pca))
- for i in unique:
- from sklearn.decomposition import PCA
- pca = PCA(num_pca)
- indices = np.where(ph_labels == i)[0]
- reduced_ph_features[indices, :] = pca.fit_transform(features[indices, :])
Add Comment
Please, Sign In to add comment