Author: Not specified Language: python
Description: Not specified Timestamp: 2018-06-11 02:52:03 +0000
View raw paste Reply
  1. mean = np.mean(dataset,axis=0)
  2. de_mean_matrix = dataset.copy()
  3. mean = np.mean(dataset,axis=0)
  4. de_mean_matrix = dataset.copy()
  5. for i in range(de_mean_matrix.shape[0]):
  6.     de_mean_matrix[i] = de_mean_matrix[i] - mean
  7. Sigma = (np.matmul(np.transpose(de_mean_matrix),de_mean_matrix))/float(N)
  8. U,S,V = np.linalg.svd(np.transpose(Sigma),full_matrices=True)
  9. r = 6
  10. U_reduced = U[:,:r]
  11. Z = np.matmul(de_mean_matrix,U_reduced)
View raw paste Reply