def generate_phase_2(phase_1, dim = 40):
  """
  The second step in creating datapoints in the Poirazi & Mel model.
  This takes a phase 1 vector, and creates a phase 2 vector where each point
  is the product of four elements of the phase 1 vector, randomly drawn with
  replacement.
  """
  phase_2 = []
  for i in range(dim):
    indices = [numpy.random.randint(0, dim) for i in range(4)]
    phase_2.append(numpy.prod([phase_1[i] for i in indices]))
  return phase_2
The second step in creating datapoints in the Poirazi & Mel model.
  This takes a phase 1 vector, and creates a phase 2 vector where each point
  is the product of four elements of the phase 1 vector, randomly drawn with
  replacement.