code: def uncertain_inputs_sparse_regression(max_iters=200, optimize=True, plot=True):
      
      fig, axes = pb.subplots(1, 2, figsize=(12, 5), sharex=True, sharey=True)
  
      # sample inputs and outputs
      S = np.ones((20, 1))
      X = np.random.uniform(-3., 3., (20, 1))
      Y = np.sin(X) + np.random.randn(20, 1) * 0.05
      # likelihood = GPy.likelihoods.Gaussian(Y)
      Z = np.random.uniform(-3., 3., (7, 1))
  
      k = GPy.kern.RBF(1)
      # create simple GP Model - no input uncertainty on this one
      m = GPy.models.SparseGPRegression(X, Y, kernel=k, Z=Z)
  
      if optimize:
          m.optimize('scg', messages=1, max_iters=max_iters)
  
      if plot:
          m.plot(ax=axes[0])
          axes[0].set_title('no input uncertainty')
      print(m)
  
      # the same Model with uncertainty
      m = GPy.models.SparseGPRegression(X, Y, kernel=GPy.kern.RBF(1), Z=Z, X_variance=S)
      if optimize:
          m.optimize('scg', messages=1, max_iters=max_iters)
      if plot:
          m.plot(ax=axes[1])
          axes[1].set_title('with input uncertainty')
          fig.canvas.draw()
  
      print(m)
      return m
docs: Run a 1D example of a sparse GP regression with uncertain inputs.