code: def get_data(N=20, P=10, S=2, Q=2, sigma_obs=0.15):
      assert S < P and P > 3 and S > 2 and Q > 1 and Q <= S
      torch.manual_seed(1)
  
      X = torch.randn(N, P)
  
      singleton_weights = 2.0 * torch.rand(S) - 1.0
      Y_mean = torch.einsum("ni,i->n", X[:, 0:S], singleton_weights)
  
      quadratic_weights = []
      expected_quad_dims = []
      for dim1 in range(Q):
          for dim2 in range(Q):
              if dim1 >= dim2:
                  continue
              expected_quad_dims.append((dim1, dim2))
              quadratic_weights.append(2.0 * torch.rand(1) - 1.0)
              Y_mean += quadratic_weights[-1] * X[:, dim1] * X[:, dim2]
      quadratic_weights = torch.tensor(quadratic_weights)
  
      # we standardize the outputs Y
      Y = Y_mean
      Y -= Y.mean()
      Y_std1 = Y.std()
      Y /= Y_std1
      Y += sigma_obs * torch.randn(N)
      Y -= Y.mean()
      Y_std2 = Y.std()
      Y /= Y_std2
  
      assert X.shape == (N, P)
      assert Y.shape == (N,)
  
      return (
          X,
          Y,
          singleton_weights / (Y_std1 * Y_std2),
          expected_quad_dims,
      )
  
file_path: pyro/examples/sparse_regression.py
imports: import argparse
  import math
  import numpy
  import torch
  from torch.optim import Adam
  import pyro
  import pyro.distributions
  from pyro import poutine
  from pyro.infer import Trace_ELBO
  from pyro.infer.autoguide import AutoDelta, init_to_median
label_desc: Use image node_id 5 for calling a global function with example usage: get_data(N, P, S, Q, sigma_obs) and returns: X,  Y,  unknown,  expected_quad_dims