docstr: Wrapper around an N-HITS deep learning model.
  
  :param stop_after: time budget in seconds.
  :param target: column to forecast.
  :param horizon: length of forecasted horizon.
  :param window: length of input data.
  :param ts_analysis: dictionary with miscellaneous time series info, as generated by 'lightwood.data.timeseries_analyzer'.
  :param train_args: arguments to steer the training process. 
      - `trainer_args`: all arguments for the PyTorchLightning trainer.
      - `conf_level`: level passed into MQLoss. Directly impacts prediction bounds. 
docstr_tok: ["Wrapper","around","an","N-HITS","deep","learning","model",".",":","param","stop_after",":","time","budget","in","seconds",".",":","param","target",":","column","to","forecast",".",":","param","horizon",":","length","of","forecasted","horizon",".",":","param","window",":","length","of","input","data",".",":","param","ts_analysis",":","dictionary","with","miscellaneous","time","series","info",",","as","generated","by","'lightwood.data.timeseries_analyzer","'",".",":","param","train_args",":","arguments","to","steer","the","training","process",".","-","`","trainer_args","`",":","all","arguments","for","the","PyTorchLightning","trainer",".","-","`","conf_level","`",":","level","passed","into","MQLoss",".","Directly","impacts","prediction","bounds","."]
code: def __init__(
      self,
      stop_after: float,
      target: str,
      horizon: int,
      window: int,
      dtype_dict: Dict,
      ts_analysis: Dict,
      pretrained: bool = False,
      train_args: Optional[Dict] = None,
  ):
      """
      Wrapper around an N-HITS deep learning model.
  
      :param stop_after: time budget in seconds.
      :param target: column to forecast.
      :param horizon: length of forecasted horizon.
      :param window: length of input data.
      :param ts_analysis: dictionary with miscellaneous time series info, as generated by 'lightwood.data.timeseries_analyzer'.
      :param train_args: arguments to steer the training process.
          - `trainer_args`: all arguments for the PyTorchLightning trainer.
          - `conf_level`: level passed into MQLoss. Directly impacts prediction bounds.
      """  # noqa
      super().__init__(stop_after)
      self.stable = False
      self.prepared = False
      self.supports_proba = False
      self.target = target
      self.window = window
      self.horizon = horizon
      self.dtype_dict = dtype_dict
      self.ts_analysis = ts_analysis
      self.grouped_by = (
          ["__default"]
          if not ts_analysis["tss"].group_by
          else ts_analysis["tss"].group_by
      )
      self.group_boundaries = (
          {}
      )  # stores last observed timestamp per series
      self.train_args = (
          train_args.get("trainer_args", {}) if train_args else {}
      )
  
      # we set a fairly aggressive training schedule by default
      self.train_args[
          "early_stop_patience_steps"
      ] = self.train_args.get("early_stop_patience_steps", 1)
      self.train_args["val_check_steps"] = self.train_args.get(
          "val_check_steps", 10
      )
      self.train_args["learning_rate"] = self.train_args.get(
          "learning_rate", 3e-3
      )
      self.train_args["mlp_units"] = self.train_args.get(
          "mlp_units", [[128, 128], [128, 128]]
      )
      self.train_args["random_seed"] = self.train_args.get(
          "random_seed", 1
      )
  
      self.conf_level = self.train_args.pop("conf_level", [90])
      for level in self.conf_level:
          assert (
              0 <= level <= 100
          ), f"A provided level is not in the [0, 100] range (found: {level})"
          assert isinstance(
              level, int
          ), f"A provided level is not an integer (found: {level})"
  
      self.pretrained = pretrained
      self.base_url = "https://nixtla-public.s3.amazonaws.com/transfer/pretrained_models/"
      self.freq_to_model = {
          "Y": "yearly",
          "Q": "monthly",
          "M": "monthly",
          "W": "daily",
          "D": "daily",
          "H": "hourly",
          "T": "hourly",  # NOTE: use another pre-trained model once available
          "S": "hourly",  # NOTE: use another pre-trained model once available
      }
      self.model = None
      self.model_class_str = self.train_args.get(
          "model_class", "nhits"
      ).lower()
      assert (
          self.model_class_str in NHitsMixer.SUPPORTED_MODELS
      ), f"Provided model class ({self.model_class_str}) is not supported. Supported models are: {NHitsMixer.SUPPORTED_MODELS}"  # noqa
      self.model_class = (
          NBEATS if self.model_class_str == "nbeats" else NHITS
      )
      self.model_name = None
      self.model_names = {
          "nhits": {
              "hourly": "nhits_m4_hourly.ckpt",  # hourly (non-tiny)
              "daily": "nhits_m4_daily.ckpt",  # daily
              "monthly": "nhits_m4_monthly.ckpt",  # monthly
              "yearly": "nhits_m4_yearly.ckpt",  # yearly
          },
          "nbeats": {},  # TODO: complete
      }
  
file_path: lightwood/lightwood/mixer/nhits.py
imports: from typing import Dict, Union, Optional
  from copy import deepcopy
  import numpy
  import pandas
  from neuralforecast import NeuralForecast
  from neuralforecast.models.nhits import NHITS
  from neuralforecast.models.nbeats import NBEATS
  from neuralforecast.losses.pytorch import MQLoss
  from lightwood.helpers.log import log
  from lightwood.mixer.base import BaseMixer
  from lightwood.api.types import PredictionArguments
  from lightwood.data.encoded_ds import EncodedDs, ConcatedEncodedDs
label_desc: Use image node_id 1 to create a new NHitsMixer object from inherited base classes: BaseMixer with example: obj = NHitsMixer(stop_after, target, horizon, window, dtype_dict, ts_analysis, pretrained, train_args)