Author: Not specified Language: text
Description: Not specified Timestamp: 2018-06-11 02:46:06 +0000
View raw paste Reply
  1. import numpy as np
  2. import random
  3. import math
  4. import matplotlib.pyplot as plt
  5. from sklearn import preprocessing
  6. D=30
  7. J=7
  8. p1= 2/3.0
  9. p2= 1/6.0
  10. p3= 1/6.0
  11. u = np.ndarray((J,D)) angles = np.zeros((J,J)) deviation = 10
  12. muZ=0
  13. sigma Z = 1
  14. mu noise = np.zeros(D)
  15. sigma noise = 0.01*np.identity(D)
  16.                                                  def
  17. draw vector(D):
  18. u = np.zeros(D) for i in range(D):
  19. r num = random.random() ifrnum>0andrnum≤ p1:
  20. u[i] = 0
  21. continue ifrnum>p1andrnum≤ p1+p2:
  22. u[i] = 1
  23. continue ifrnum>p1+p2andrnum≤ 1:
  24.                                     u[i] = −1 continue
  25.     return u
  26.     for
  27. i in range(J):
  28. u[i] = draw vector(D)
View raw paste Reply