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"]
code: def __init__(
      self,
      data,
      ar,
      units,
      layers,
      integ=0,
      target=None,
      family=fam.Normal(),
      activation=np.tanh,
      initialize_random=True,
  ):
      # Initialize TSM object
      super(NNAR, self).__init__("NNAR")
  
      # Latent Variable information
      self.ar = ar
      self.units = units
      self.layers = layers
      self.integ = integ
      self.target = target
      self.activation = activation
      self.z_no = self.ar + 2
      self.max_lag = self.ar
      self._z_hide = (
          0  # Whether to cutoff latent variables from results table
      )
      self.supported_methods = ["BBVI"]
      self.default_method = "BBVI"
      self.multivariate_model = False
  
      # Format the data
      (
          self.data,
          self.data_name,
          self.is_pandas,
          self.index,
      ) = dc.data_check(data, target)
      self.data = self.data.astype(
          np.float
      )  # treat as float for Cython
      self.data_original = self.data.copy()
  
      self._norm_mean = np.mean(self.data)
      self._norm_std = np.std(self.data)
  
      # Difference data
      for order in range(0, self.integ):
          self.data = np.diff(self.data)
          self.data_name = "Differenced " + self.data_name
  
      self.data_length = self.data.shape[0]
  
      self.X = self._ar_matrix()
      self._create_latent_variables()
  
      self.family = family
  
      (
          self.model_name2,
          self.link,
          self.scale,
          self.shape,
          self.skewness,
          self.mean_transform,
          self.cythonized,
      ) = self.family.setup()
  
      self.model_name = (
          self.model_name2
          + " NNAR("
          + str(self.ar)
          + ","
          + str(self.integ)
          + ")"
      )
  
      # Build any remaining latent variables that are specific to the family chosen
      for no, i in enumerate(self.family.build_latent_variables()):
          self.latent_variables.add_z(i[0], i[1], i[2])
          self.latent_variables.z_list[-1].start = i[3]
  
      self.z_no = len(self.latent_variables.z_list)
      self.family_z_no = len(self.family.build_latent_variables())
  
      # Initialize with random weights
      if initialize_random is True:
          for var_no in range(
              len(self.latent_variables.z_list) - self.family_z_no
          ):
              self.latent_variables.z_list[
                  var_no
              ].start = np.random.normal()
  
      if isinstance(self.family, fam.Normal):
          self.neg_loglik = self.normal_neg_loglik
      else:
          self.neg_loglik = self.general_neg_loglik
  
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 1 to create a new NNAR object from inherited base classes: tsm with example: obj = NNAR(data, ar, units, layers, integ, target, family, activation, initialize_random)