code: def test_ar_mle(self):
      # set up test data: a random walk
      T = 100
      z_true = np.zeros(T)
      r = 0.95
      sig = 0.01
      eta = 0.01
      for t in range(1, 100):
          z_true[t] = r * z_true[t - 1] + sig * np.random.randn()
  
      x_data = (z_true + eta * np.random.randn(T)).astype(np.float32)
  
      # use scipy to find max likelihood
      def cost(z):
          initial = z[0] ** 2 / sig**2
          ar = np.sum((z[1:] - r * z[:-1]) ** 2) / sig**2
          data = np.sum((x_data - z) ** 2) / eta**2
          return initial + ar + data
  
      mle = minimize(cost, np.zeros(T)).x
  
      with self.test_session() as sess:
          z = AutoRegressive(T, r, sig)
          x = Normal(loc=z, scale=eta)
  
          qz = PointMass(params=tf.Variable(tf.zeros(T)))
          inference = ed.MAP({z: qz}, data={x: x_data})
          inference.run(n_iter=500)
  
          self.assertAllClose(qz.eval(), mle, rtol=1e-3, atol=1e-3)
  
file_path: edward/tests/inferences/ar_process_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import edward
  import numpy
  import tensorflow
  from edward.models import Normal, PointMass
  from scipy.optimize import minimize
  from edward.models import RandomVariable
  from tensorflow.contrib.distributions import Distribution
  from tensorflow.contrib.distributions import FULLY_REPARAMETERIZED
label_desc: Use image node_id 1 for calling the test_ar_process obj's underlying member method code with example usage: obj.test_ar_mle() and returns: unknown