class_docstr: Multivariate quantile loss based on the article
  `Multivariate Quantile Function Forecaster <http://arxiv.org/abs/2202.11316>`_.
  
  Requires install of additional library:
  ``pip install pytorch-forecasting[mqf2]``
class_docstr_tok: ["Multivariate","quantile","loss","based","on","the","article","`","Multivariate","Quantile","Function","Forecaster","<","http",":","\/\/arxiv.org\/abs\/2202.11316",">","`","_",".","Requires","install","of","additional","library",":","``","pip","install","pytorch-forecasting","[","mqf2","]","``"]
docstr: Args:
      prediction_length (int): maximum prediction length.
      quantiles (List[float], optional): default quantiles to output.
          Defaults to [0.02, 0.1, 0.25, 0.5, 0.75, 0.9, 0.98].
      hidden_size (int, optional): hidden size per prediction length. Defaults to 4.
      es_num_samples (int, optional): Number of samples to calculate energy score.
          If None, maximum liklihood is used as opposed to energy score for optimization.
          Defaults to 50.
      beta (float, optional): between 0 and 1.0 to control how scale sensitive metric is (1=fully sensitive).
          Defaults to 1.0.
      icnn_hidden_size (int, optional): hidden size of distribution estimating network. Defaults to 20.
      icnn_num_layers (int, optional): number of hidden layers in distribution estimating network. Defaults to 2.
      estimate_logdet (bool, optional): if to estimate log determinant. Defaults to False.
docstr_tok: ["Args",":","prediction_length","(","int",")",":","maximum","prediction","length",".","quantiles","(","List","[","float","]",",","optional",")",":","default","quantiles","to","output",".","Defaults","to","[","0.02",",","0.1",",","0.25",",","0.5",",","0.75",",","0.9",",","0.98","]",".","hidden_size","(","int",",","optional",")",":","hidden","size","per","prediction","length",".","Defaults","to","4.","es_num_samples","(","int",",","optional",")",":","Number","of","samples","to","calculate","energy","score",".","If","None",",","maximum","liklihood","is","used","as","opposed","to","energy","score","for","optimization",".","Defaults","to","50.","beta","(","float",",","optional",")",":","between","0","and","1.0","to","control","how","scale","sensitive","metric","is","(","1=fully","sensitive",")",".","Defaults","to","1.0.","icnn_hidden_size","(","int",",","optional",")",":","hidden","size","of","distribution","estimating","network",".","Defaults","to","20.","icnn_num_layers","(","int",",","optional",")",":","number","of","hidden","layers","in","distribution","estimating","network",".","Defaults","to","2.","estimate_logdet","(","bool",",","optional",")",":","if","to","estimate","log","determinant",".","Defaults","to","False","."]
code: def __init__(
      self,
      prediction_length: int,
      quantiles: List[float] = [0.02, 0.1, 0.25, 0.5, 0.75, 0.9, 0.98],
      hidden_size: Optional[int] = 4,
      es_num_samples: int = 50,
      beta: float = 1.0,
      icnn_hidden_size: int = 20,
      icnn_num_layers: int = 2,
      estimate_logdet: bool = False,
  ) -> None:
      """
      Args:
          prediction_length (int): maximum prediction length.
          quantiles (List[float], optional): default quantiles to output.
              Defaults to [0.02, 0.1, 0.25, 0.5, 0.75, 0.9, 0.98].
          hidden_size (int, optional): hidden size per prediction length. Defaults to 4.
          es_num_samples (int, optional): Number of samples to calculate energy score.
              If None, maximum liklihood is used as opposed to energy score for optimization.
              Defaults to 50.
          beta (float, optional): between 0 and 1.0 to control how scale sensitive metric is (1=fully sensitive).
              Defaults to 1.0.
          icnn_hidden_size (int, optional): hidden size of distribution estimating network. Defaults to 20.
          icnn_num_layers (int, optional): number of hidden layers in distribution estimating network. Defaults to 2.
          estimate_logdet (bool, optional): if to estimate log determinant. Defaults to False.
      """
      super().__init__(quantiles=quantiles)
  
      from cpflows.flows import ActNorm
      from cpflows.icnn import PICNN
  
      from pytorch_forecasting.metrics._mqf2_utils import (
          DeepConvexNet,
          MQF2Distribution,
          SequentialNet,
          TransformedMQF2Distribution,
      )
  
      self.distribution_class = MQF2Distribution
      self.transformed_distribution_class = TransformedMQF2Distribution
      self.distribution_arguments = list(range(int(hidden_size)))
      self.prediction_length = prediction_length
      self.es_num_samples = es_num_samples
      self.beta = beta
  
      # define picnn
      convexnet = PICNN(
          dim=prediction_length,
          dimh=icnn_hidden_size,
          dimc=hidden_size * prediction_length,
          num_hidden_layers=icnn_num_layers,
          symm_act_first=True,
      )
      deepconvexnet = DeepConvexNet(
          convexnet,
          prediction_length,
          is_energy_score=self.is_energy_score,
          estimate_logdet=estimate_logdet,
      )
  
      if self.is_energy_score:
          networks = [deepconvexnet]
      else:
          networks = [
              ActNorm(prediction_length),
              deepconvexnet,
              ActNorm(prediction_length),
          ]
  
      self.picnn = SequentialNet(networks)
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  from sklearn.base import BaseEstimator
  import torch
  from torch import distributions, nn
  import torch.nn.functional
  from pytorch_forecasting.data.encoders import TorchNormalizer, softplus_inv
  from pytorch_forecasting.metrics.base_metrics import DistributionLoss, MultivariateDistributionLoss
label_desc: Use image node_id 1 to create a new MQF2DistributionLoss object from inherited base classes: DistributionLoss with example: obj = MQF2DistributionLoss(prediction_length, quantiles, hidden_size, es_num_samples, beta, icnn_hidden_size, icnn_num_layers, estimate_logdet)