docstr: Convenience function to create network from :py:class`~pytorch_forecasting.data.timeseries.TimeSeriesDataSet`.
  
  Args:
      dataset (TimeSeriesDataSet): dataset where sole predictor is the target.
      **kwargs: additional arguments to be passed to ``__init__`` method.
  
  Returns:
      NBeats
docstr_tok: ["Convenience","function","to","create","network","from",":","py",":","class","`","~pytorch_forecasting.data.timeseries.TimeSeriesDataSet","`",".","Args",":","dataset","(","TimeSeriesDataSet",")",":","dataset","where","sole","predictor","is","the","target",".","*","*","kwargs",":","additional","arguments","to","be","passed","to","``","__init__","``","method",".","Returns",":","NBeats"]
code: def from_dataset(cls, dataset: TimeSeriesDataSet, **kwargs):
      """
      Convenience function to create network from :py:class`~pytorch_forecasting.data.timeseries.TimeSeriesDataSet`.
  
      Args:
          dataset (TimeSeriesDataSet): dataset where sole predictor is the target.
          **kwargs: additional arguments to be passed to ``__init__`` method.
  
      Returns:
          NBeats
      """
      # validate arguments
      assert not isinstance(
          dataset.target_normalizer, NaNLabelEncoder
      ), "only regression tasks are supported - target must not be categorical"
      assert (
          dataset.min_encoder_length == dataset.max_encoder_length
      ), "only fixed encoder length is allowed, but min_encoder_length != max_encoder_length"
  
      assert (
          dataset.max_prediction_length == dataset.min_prediction_length
      ), "only fixed prediction length is allowed, but max_prediction_length != min_prediction_length"
  
      assert (
          dataset.randomize_length is None
      ), "length has to be fixed, but randomize_length is not None"
      assert (
          not dataset.add_relative_time_idx
      ), "add_relative_time_idx has to be False"
  
      new_kwargs = copy(kwargs)
      new_kwargs.update(
          {
              "prediction_length": dataset.max_prediction_length,
              "context_length": dataset.max_encoder_length,
          }
      )
      new_kwargs.update(
          cls.deduce_default_output_parameters(dataset, kwargs, MASE())
      )
  
      assert (new_kwargs.get("backcast_loss_ratio", 0) == 0) | (
          isinstance(new_kwargs["output_size"], int)
          and new_kwargs["output_size"] == 1
      ) or all(
          o == 1 for o in new_kwargs["output_size"]
      ), "output sizes can only be of size 1, i.e. point forecasts if backcast_loss_ratio > 0"
  
      # initialize class
      return super().from_dataset(dataset, **new_kwargs)
  
imports: from copy import copy
  from typing import Dict, List, Optional, Tuple, Union
  from matplotlib import pyplot
  import numpy
  import torch
  from torch import nn
  from pytorch_forecasting.data import TimeSeriesDataSet
  from pytorch_forecasting.data.encoders import NaNLabelEncoder
  from pytorch_forecasting.metrics import MAE, MAPE, MASE, RMSE, SMAPE, MultiHorizonMetric, MultiLoss
  from pytorch_forecasting.models.base_model import BaseModelWithCovariates
  from pytorch_forecasting.models.nhits.sub_modules import NHiTS
  from pytorch_forecasting.models.nn.embeddings import MultiEmbedding
  from pytorch_forecasting.utils import create_mask, detach, to_list
label_desc: Use image node_id 7 for calling the NHiTS obj's underlying member method code with example usage: obj.from_dataset(cls, dataset) and returns: super