code: def approximating_model_reg(self, beta, T, Z, R, Q, h_approx, data, X, state_no):
               
          
          H = np.ones(data.shape[0])
          mu = np.zeros(data.shape[0])
  
          alpha = np.zeros([state_no, data.shape[0]])
          tol = 100.0
          it = 0
          while tol > 10**-7 and it < 5:
              old_alpha = np.sum(X*alpha.T,axis=1)
              alpha, V = nld_univariate_KFS(data,Z,H,T,Q,R,mu)
              H = np.exp(-np.sum(X*alpha.T,axis=1))
              mu = data - np.sum(X*alpha.T,axis=1) - np.exp(-np.sum(X*alpha.T,axis=1))*(data - np.exp(np.sum(X*alpha.T,axis=1)))
              tol = np.mean(np.abs(np.sum(X*alpha.T,axis=1)-old_alpha))
              it += 1
  
          return H, mu
docs: Creates approximating Gaussian model for Poisson measurement density
          - dynamic regression model
  
          Parameters
          ----------
          beta : np.array
              Contains untransformed starting values for latent variables
  
          T, Z, R, Q : np.array
              State space matrices used in KFS algorithm
  
          data: np.array
              The univariate time series data
  
          X: np.array
              The regressors
  
          state_no : int
              Number of states
  
          Returns
          ----------
  
          H : np.array
              Approximating measurement variance matrix
  
          mu : np.array
              Approximating measurement constants