code: def __post_init__(self):
      if self.growth not in ["off", "linear", "discontinuous"]:
          log.error(
              f"Invalid trend growth '{self.growth}'. Set to 'linear'"
          )
          self.growth = "linear"
  
      if self.growth == "off":
          self.changepoints = None
          self.n_changepoints = 0
  
      if self.changepoints is not None:
          self.n_changepoints = len(self.changepoints)
          self.changepoints = (
              pd.to_datetime(self.changepoints).sort_values().values
          )
  
      if self.trend_reg_threshold is None:
          pass
      elif isinstance(self.trend_reg_threshold, bool):
          if self.trend_reg_threshold:
              self.trend_reg_threshold = 3.0 / (
                  3.0
                  + (1.0 + self.trend_reg)
                  * np.sqrt(self.n_changepoints)
              )
              log.debug(
                  f"Trend reg threshold automatically set to: {self.trend_reg_threshold}"
              )
          else:
              self.trend_reg_threshold = None
      elif self.trend_reg_threshold < 0:
          log.warning("Negative trend reg threshold set to zero.")
          self.trend_reg_threshold = None
      elif math.isclose(self.trend_reg_threshold, 0):
          self.trend_reg_threshold = None
  
      if self.trend_reg < 0:
          log.warning("Negative trend reg lambda set to zero.")
          self.trend_reg = 0
      if self.trend_reg > 0:
          if self.n_changepoints > 0:
              log.info(
                  "Note: Trend changepoint regularization is experimental."
              )
              self.trend_reg = 0.001 * self.trend_reg
          else:
              log.info(
                  "Trend reg lambda ignored due to no changepoints."
              )
              self.trend_reg = 0
              if (
                  self.trend_reg_threshold
                  and self.trend_reg_threshold > 0
              ):
                  log.info(
                      "Trend reg threshold ignored due to no changepoints."
                  )
      else:
          if (
              self.trend_reg_threshold is not None
              and self.trend_reg_threshold > 0
          ):
              log.info(
                  "Trend reg threshold ignored due to reg lambda <= 0."
              )
  
      # If trend_global_local is not in the expected set, set to "global"
      if self.trend_global_local not in ["global", "local"]:
          log.error(
              "Invalid global_local mode '{}'. Set to 'global'".format(
                  self.trend_global_local
              )
          )
          self.trend_global_local = "global"
  
      # If growth is off we want set to "global"
      if (self.growth == "off") and (
          self.trend_global_local == "local"
      ):
          log.error(
              "Invalid growth for global_local mode '{}'. Set to 'global'".format(
                  self.trend_global_local
              )
          )
          self.trend_global_local = "global"
  
imports: from __future__ import annotations
  import logging
  import math
  import types
  from collections import OrderedDict
  from dataclasses import dataclass, field
  from typing import Callable, List, Optional
  from typing import OrderedDict
  from typing import Type, Union
  import numpy
  import pandas
  import torch
  from neuralprophet import df_utils, np_types, utils, utils_torch
  from neuralprophet.custom_loss_metrics import PinballLoss
label_desc: Use image node_id 1 for calling the Trend obj's underlying member method code with example usage: obj.__post_init__() without return types