code: def run_synthetic_SGLD():
      
      theta1 = 0
      theta2 = 1
      sigma1 = numpy.sqrt(10)
      sigma2 = 1
      sigmax = numpy.sqrt(2)
      X = load_synthetic(theta1=theta1, theta2=theta2, sigmax=sigmax, num=100)
      minibatch_size = 1
      total_iter_num = 1000000
      lr_scheduler = SGLDScheduler(begin_rate=0.01, end_rate=0.0001, total_iter_num=total_iter_num,
                                   factor=0.55)
      optimizer = mx.optimizer.create('sgld',
                                      learning_rate=None,
                                      rescale_grad=1.0,
                                      lr_scheduler=lr_scheduler,
                                      wd=0)
      updater = mx.optimizer.get_updater(optimizer)
      theta = mx.random.normal(0, 1, (2,), mx.cpu())
      grad = nd.empty((2,), mx.cpu())
      samples = numpy.zeros((2, total_iter_num))
      start = time.time()
      for i in range(total_iter_num):
          if (i + 1) % 100000 == 0:
              end = time.time()
              print("Iter:%d, Time spent: %f" % (i + 1, end - start))
              start = time.time()
          ind = numpy.random.randint(0, X.shape[0])
          synthetic_grad(X[ind], theta, sigma1, sigma2, sigmax,
                         rescale_grad=X.shape[0] / float(minibatch_size), grad=grad)
          updater('theta', grad, theta)
          samples[:, i] = theta.asnumpy()
      plt.hist2d(samples[0, :], samples[1, :], (200, 200), cmap=plt.cm.jet)
      plt.colorbar()
      plt.show()
docs: Run synthetic SGLD