code: def __create_proj_mat(self, size):
          
  
          # [1]
          # return np.random.choice([-np.sqrt(3), 0, np.sqrt(3)], size=size, p=[1 / 6, 2 / 3, 1 / 6])
  
          # [2]
          s = 1 / self.density
          return np.random.choice([-np.sqrt(s / self.k), 0, np.sqrt(s / self.k)],
                                  size=size,
                                  p=[1 / (2 * s), 1 - 1 / s, 1 / (2 * s)])
docs: Create a random projection matrix
  
          [1] D. Achlioptas. Database-friendly random projections: Johnson-Lindenstrauss with binary coins.
          [2] P. Li, et al. Very sparse random projections.
  
          http://scikit-learn.org/stable/modules/random_projection.html#sparse-random-projection