def generate_matrices ( dim = 40 ) : positive = numpy . random . uniform ( - 1 , 1 , ( dim , dim ) ) negative = positive + numpy . random . normal ( 0 , 1 , ( dim , dim ) ) return positive , negative
how to define a matrix of random numbers in python
Generates the matrices that positive and negative samples are multiplied with . The matrix for positive samples is randomly drawn from a uniform distribution with elements in [ - 1 1 ] . The matrix for negative examples is the sum of the positive matrix with a matrix drawn from a normal distribution with mean 0 variance 1 .
def generate_matrices(dim = 40):
  """
  Generates the matrices that positive and negative samples are multiplied
  with.  The matrix for positive samples is randomly drawn from a uniform
  distribution, with elements in [-1, 1].  The matrix for negative examples
  is the sum of the positive matrix with a matrix drawn from a normal
  distribution with mean 0 variance 1.
  """
  positive = numpy.random.uniform(-1, 1, (dim, dim))
  negative = positive + numpy.random.normal(0, 1, (dim, dim))
  return positive, negative