class_docstr: Negative binomial loss, e.g. for count data.
  
  Requirements for original target normalizer:
      * not centered normalization (only rescaled)
class_docstr_tok: ["Negative","binomial","loss",",","e.g",".","for","count","data",".","Requirements","for","original","target","normalizer",":","*","not","centered","normalization","(","only","rescaled",")"]
code: def rescale_parameters(
      self,
      parameters: torch.Tensor,
      target_scale: torch.Tensor,
      encoder: BaseEstimator,
  ) -> torch.Tensor:
      assert (
          not encoder.center
      ), "NegativeBinomialDistributionLoss is not compatible with `center=True` normalization"
      assert encoder.transformation not in [
          "logit",
          "log",
      ], "Cannot use bound transformation such as 'logit'"
      if encoder.transformation in ["log1p"]:
          mean = torch.exp(
              parameters[..., 0] * target_scale[..., 1].unsqueeze(-1)
          )
          shape = (
              F.softplus(torch.exp(parameters[..., 1]))
              / torch.exp(
                  target_scale[..., 1].unsqueeze(-1)
              ).sqrt()  # todo: is this correct?
          )
      else:
          mean = F.softplus(parameters[..., 0]) * target_scale[
              ..., 1
          ].unsqueeze(-1)
          shape = (
              F.softplus(parameters[..., 1])
              / target_scale[..., 1].unsqueeze(-1).sqrt()
          )
      return torch.stack([mean, shape], dim=-1)
  
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 2 for calling the NegativeBinomialDistributionLoss obj's underlying member method code with example usage: obj.rescale_parameters(parameters, target_scale, encoder) and returns: torch