code: def _mb_model(self, beta, mini_batch):
               
  
          # Transform latent variables
          parm = np.array([self.latent_variables.z_list[k].prior.transform(beta[k]) for k in range(beta.shape[0])])
  
          rand_int =  np.random.randint(low=0, high=self.data_length-mini_batch+1)
          sample = np.arange(start=rand_int, stop=rand_int+mini_batch)
          sampled_data = self.data[sample]
  
          xeps = np.power(sampled_data-parm[-1],2)
          Y = np.array(sampled_data[self.max_lag:])
          eps = np.power(Y-parm[-1],2)
          X = np.ones(Y.shape[0])
  
          # ARCH terms
          if self.q != 0:
              for i in range(0,self.q):   
                  X = np.vstack((X,xeps[(self.max_lag-i-1):-i-1]))
              sigma2 = np.matmul(np.transpose(X),parm[0:-self.p-1])
          else:
              sigma2 = np.transpose(X*parm[0])
  
          sigma2 = garch_recursion(parm, sigma2, self.q, self.p, Y.shape[0], self.max_lag)
  
          return np.array(sigma2), Y, eps
docs: Creates the structure of the model (model matrices etc) for mini batch model.
          
          Here the structure is the same as for _normal_model() but we are going to
          sample a random choice of data points (of length mini_batch).
  
          Parameters
          ----------
          beta : np.ndarray
              Contains untransformed starting values for the latent variables
  
          mini_batch : int
              Mini batch size for the data sampling
  
          Returns
          ----------
          mu : np.ndarray
              Contains the predicted values (location) for the time series
  
          Y : np.ndarray
              Contains the length-adjusted time series (accounting for lags)