class_docstr: Inherits time series methods from TSM parent class.
  
  **** NEURAL NETWORK AUTOREGRESSIVE INTEGRATED (NNAR) MODELS ****
  
  Parameters
  ----------
  data : pd.DataFrame or np.ndarray
      Field to specify the univariate time series data that will be used.
  
  ar : int
      Field to specify how many AR lags the model will have.
  
  integ : int (default : 0)
      Specifies how many times to difference the time series.
  
  units : int
      How many units for the neural network
  
  layers : int
      How many layers for the neural networ
  
  activation : function
      E.g. np.tanh, np.array (linear)
  
  target : str (if data is a pd.DataFrame) or int (if data is a np.ndarray)
      Specifies which column name or array index to use. By default, first
      column/array index will be selected as the dependent variable.
  
  family: family object
      E.g. pf.Normal()
  
  activation : function
      Non-linear transformation for the weights, e.g. np.tanh
  
  initialize_random : boolean
      Whether to initialzie the weights with N(0,1) random variables
class_docstr_tok: ["Inherits","time","series","methods","from","TSM","parent","class",".","*","*","*","*","NEURAL","NETWORK","AUTOREGRESSIVE","INTEGRATED","(","NNAR",")","MODELS","*","*","*","*","Parameters","--","--","--","--","--","data",":","pd.DataFrame","or","np.ndarray","Field","to","specify","the","univariate","time","series","data","that","will","be","used",".","ar",":","int","Field","to","specify","how","many","AR","lags","the","model","will","have",".","integ",":","int","(","default",":","0",")","Specifies","how","many","times","to","difference","the","time","series",".","units",":","int","How","many","units","for","the","neural","network","layers",":","int","How","many","layers","for","the","neural","networ","activation",":","function","E.g",".","np.tanh",",","np.array","(","linear",")","target",":","str","(","if","data","is","a","pd.DataFrame",")","or","int","(","if","data","is","a","np.ndarray",")","Specifies","which","column","name","or","array","index","to","use",".","By","default",",","first","column\/array","index","will","be","selected","as","the","dependent","variable",".","family",":","family","object","E.g",".","pf.Normal","(",")","activation",":","function","Non-linear","transformation","for","the","weights",",","e.g",".","np.tanh","initialize_random",":","boolean","Whether","to","initialzie","the","weights","with","N","(","0,1",")","random","variables"]
docstr: Creates the structure of the model (model matrices etc)
  
  Parameters
  ----------
  beta : np.ndarray
      Contains untransformed starting values for the latent variables
  
  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)
docstr_tok: ["Creates","the","structure","of","the","model","(","model","matrices","etc",")","Parameters","--","--","--","--","--","beta",":","np.ndarray","Contains","untransformed","starting","values","for","the","latent","variables","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",")"]
code: def _model(self, beta):
      """Creates the structure of the model (model matrices etc)
  
      Parameters
      ----------
      beta : np.ndarray
          Contains untransformed starting values for the latent variables
  
      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)
      """
  
      Y = np.array(self.data[self.max_lag :])
  
      # Transform latent variables
      z = np.array(
          [
              self.latent_variables.z_list[k].prior.transform(beta[k])
              for k in range(beta.shape[0])
          ]
      )
      bias = z[
          self.latent_variables.z_indices["Bias"][
              "start"
          ] : self.latent_variables.z_indices["Bias"]["end"]
          + 1
      ]
      bias = np.reshape(bias, (-1, self.units))
      output_bias = z[
          self.latent_variables.z_indices["Output bias"]["start"]
      ]
      input_weights = z[
          self.latent_variables.z_indices["Input weight"][
              "start"
          ] : self.latent_variables.z_indices["Input weight"]["end"]
          + 1
      ]
      input_weights = np.reshape(input_weights, (-1, self.units))
      output_weights = z[
          self.latent_variables.z_indices["Output weight"][
              "start"
          ] : self.latent_variables.z_indices["Output weight"]["end"]
          + 1
      ]
  
      # Construct neural network
      h = self.activation(self.X.T.dot(input_weights) + bias[0])
  
      if self.layers > 1:
          hidden_weights = z[
              self.latent_variables.z_indices["Hidden weight"][
                  "start"
              ] : self.latent_variables.z_indices["Hidden weight"][
                  "end"
              ]
              + 1
          ]
          hidden_weights = np.reshape(
              hidden_weights, (self.layers - 1, self.units, -1)
          )
  
          for k in range(0, self.layers - 1):
              h = self.activation(
                  h.dot(hidden_weights[k]) + bias[1 + k]
              )
  
      return h.dot(output_weights) + output_bias, Y
  
imports: import sys
  import numpy
  import pandas
  import scipy.stats
  from ..None import families
  from ..None import output
  from ..None import tests
  from ..None import tsm
  from ..None import data_check
  from .nn_architecture import neural_network_tanh, neural_network_tanh_mb
label_desc: Use image node_id 6 for calling the NNAR obj's underlying member method code with example usage: obj._model(beta) and returns: unknown,  Y