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
      """
      new_kwargs = {
          "prediction_length": dataset.max_prediction_length,
          "context_length": dataset.max_encoder_length,
      }
      new_kwargs.update(kwargs)
  
      # validate arguments
      assert isinstance(
          dataset.target, str
      ), "only one target is allowed (passed as string to dataset)"
      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"
  
      assert (
          len(dataset.flat_categoricals) == 0
          and len(dataset.reals) == 1
          and len(dataset.time_varying_unknown_reals) == 1
          and dataset.time_varying_unknown_reals[0] == dataset.target
      ), "The only variable as input should be the target which is part of time_varying_unknown_reals"
  
      # initialize class
      return super().from_dataset(dataset, **new_kwargs)
  
file_path: pytorch-forecasting/pytorch_forecasting/models/nbeats/__init__.py
imports: from typing import Dict, List
  import matplotlib.pyplot
  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
  from pytorch_forecasting.models.base_model import BaseModel
  from pytorch_forecasting.models.nbeats.sub_modules import NBEATSGenericBlock, NBEATSSeasonalBlock, NBEATSTrendBlock
label_desc: Use image node_id 3 for calling the NBeats obj's underlying member method code with example usage: obj.from_dataset(cls, dataset) and returns: super