class_docstr: Base KTR model object with shared functionality for PyroVI method
  Parameters
  ----------
  level_knot_scale : float
      sigma for level; default to be .1
  level_segments : int
      the number of segments partitioned by the knots of level (trend)
  level_knot_distance : int
      the distance between every two knots of level (trend)
  level_knot_dates : array like
      list of pre-specified dates for the level knots
  seasonality : int, or list of int
      multiple seasonality
  seasonality_fs_order : int, or list of int
      fourier series order for seasonality
  seasonality_segments : int
      the number of segments partitioned by the knots of seasonality
  seasonal_initial_knot_scale : float
      scale parameter for seasonal regressors initial coefficient knots; default to be 1
  seasonal_knot_scale : float
      scale parameter for seasonal regressors drift of coefficient knots; default to be 0.1.
  regressor_col : array-like strings
      regressor columns
  regressor_sign : list
      list of signs with '=' for regular regressor, '+' for positive regressor, and '-' for negative regressor.
  regressor_init_knot_loc : list
      list of regressor knot pooling mean priors, default to be 0's
  regressor_init_knot_scale : list
      list of regressor knot pooling sigma's to control the pooling strength towards the grand mean of regressors;
      default to be 1.
  regressor_knot_scale : list
      list of regressor knot sigma priors; default to be 0.1.
  regression_segments : int
      the number of segments partitioned by the knots of regression
  regression_knot_distance : int
      the distance between every two knots of regression
  regression_knot_dates : array-like
      list of pre-specified dates for regression knots
  regression_rho : float
      sigma in the Gaussian kernel for the regression term
  degree of freedom : int
      degree of freedom for error t-distribution
  date_freq : str
      date frequency; if not supplied, pd.infer_freq will be used to imply the date frequency.
  coef_prior_list : list of dicts
      each dict in the list should have keys as
      'name', prior_start_tp_idx' (inclusive), KTRTimePointPriorKeys.PRIOR_END_TP_IDX.value (not inclusive),
      KTRTimePointPriorKeys.PRIOR_MEAN.value, KTRTimePointPriorKeys.PRIOR_SD.value, and KTRTimePointPriorKeys.PRIOR_REGRESSOR_COL.value
  residuals_scale_upper : float
  flat_multiplier : bool
      Default set as True. If False, we will adjust knot scale with a multiplier based on regressor volume
      around each knot; When True, set all multiplier as 1
  ktrlite_optim_args : dict
      the optimizing config for the ktrlite model (to fit level/seasonality). Default to be dict().
class_docstr_tok: ["Base","KTR","model","object","with","shared","functionality","for","PyroVI","method","Parameters","--","--","--","--","--","level_knot_scale",":","float","sigma","for","level",";","default","to","be",".1","level_segments",":","int","the","number","of","segments","partitioned","by","the","knots","of","level","(","trend",")","level_knot_distance",":","int","the","distance","between","every","two","knots","of","level","(","trend",")","level_knot_dates",":","array","like","list","of","pre-specified","dates","for","the","level","knots","seasonality",":","int",",","or","list","of","int","multiple","seasonality","seasonality_fs_order",":","int",",","or","list","of","int","fourier","series","order","for","seasonality","seasonality_segments",":","int","the","number","of","segments","partitioned","by","the","knots","of","seasonality","seasonal_initial_knot_scale",":","float","scale","parameter","for","seasonal","regressors","initial","coefficient","knots",";","default","to","be","1","seasonal_knot_scale",":","float","scale","parameter","for","seasonal","regressors","drift","of","coefficient","knots",";","default","to","be","0.1.","regressor_col",":","array-like","strings","regressor","columns","regressor_sign",":","list","list","of","signs","with","'=","'","for","regular","regressor",",","'+","'","for","positive","regressor",",","and","'-","'","for","negative","regressor",".","regressor_init_knot_loc",":","list","list","of","regressor","knot","pooling","mean","priors",",","default","to","be","0's","regressor_init_knot_scale",":","list","list","of","regressor","knot","pooling","sigma","'s","to","control","the","pooling","strength","towards","the","grand","mean","of","regressors",";","default","to","be","1.","regressor_knot_scale",":","list","list","of","regressor","knot","sigma","priors",";","default","to","be","0.1.","regression_segments",":","int","the","number","of","segments","partitioned","by","the","knots","of","regression","regression_knot_distance",":","int","the","distance","between","every","two","knots","of","regression","regression_knot_dates",":","array-like","list","of","pre-specified","dates","for","regression","knots","regression_rho",":","float","sigma","in","the","Gaussian","kernel","for","the","regression","term","degree","of","freedom",":","int","degree","of","freedom","for","error","t-distribution","date_freq",":","str","date","frequency",";","if","not","supplied",",","pd.infer_freq","will","be","used","to","imply","the","date","frequency",".","coef_prior_list",":","list","of","dicts","each","dict","in","the","list","should","have","keys","as","'name","'",",","prior_start_tp_idx","'","(","inclusive",")",",","KTRTimePointPriorKeys.PRIOR_END_TP_IDX.value","(","not","inclusive",")",",","KTRTimePointPriorKeys.PRIOR_MEAN.value",",","KTRTimePointPriorKeys.PRIOR_SD.value",",","and","KTRTimePointPriorKeys.PRIOR_REGRESSOR_COL.value","residuals_scale_upper",":","float","flat_multiplier",":","bool","Default","set","as","True",".","If","False",",","we","will","adjust","knot","scale","with","a","multiplier","based","on","regressor","volume","around","each","knot",";","When","True",",","set","all","multiplier","as","1","ktrlite_optim_args",":","dict","the","optimizing","config","for","the","ktrlite","model","(","to","fit","level\/seasonality",")",".","Default","to","be","dict","(",")","."]
code: def __init__(
      self,
      # level
      level_knot_scale=0.1,
      level_segments=10,
      level_knot_distance=None,
      level_knot_dates=None,
      # seasonality
      seasonality=None,
      seasonality_fs_order=None,
      seasonality_segments=2,
      seasonal_initial_knot_scale=1.0,
      seasonal_knot_scale=0.1,
      # regression
      regressor_col=None,
      regressor_sign=None,
      regressor_init_knot_loc=None,
      regressor_init_knot_scale=None,
      regressor_knot_scale=None,
      regression_segments=5,
      regression_knot_distance=None,
      regression_knot_dates=None,
      regression_rho=0.15,
      # shared
      degree_of_freedom=30,
      date_freq=None,
      # time-based coefficient priors
      coef_prior_list=None,
      flat_multiplier=True,
      residuals_scale_upper=None,
      ktrlite_optim_args=dict(),
      **kwargs,
  ):
      super().__init__(**kwargs)  # create estimator in base class
  
      # level configurations
      self.level_knot_scale = level_knot_scale
      self.level_segments = level_segments
      self.level_knot_distance = level_knot_distance
      self.level_knot_dates = level_knot_dates
      self._level_knot_dates = self.level_knot_dates
      self.level_knots = None
      self._level_knots = None
  
      self._kernel_level = None
      self._num_knots_level = None
      self.knots_tp_level = None
  
      # seasonality configurations
      self.seasonality = seasonality
      self.seasonality_fs_order = seasonality_fs_order
      self._seasonality = self.seasonality
      # used to name different seasonal components in prediction
      self._seasonality_fs_order = self.seasonality_fs_order
      self.seasonal_initial_knot_scale = seasonal_initial_knot_scale
      self.seasonal_knot_scale = seasonal_knot_scale
      self.seasonality_segments = seasonality_segments
      self._seas_term = 0
  
      self._seasonality_coef_knot_dates = None
      self._seasonality_coef_knots = None
  
      # regression configurations
      self.regressor_col = regressor_col
      self.regressor_sign = regressor_sign
      self.regressor_init_knot_loc = regressor_init_knot_loc
      self.regressor_init_knot_scale = regressor_init_knot_scale
      self.regressor_knot_scale = regressor_knot_scale
      self.regression_knot_distance = regression_knot_distance
      self.regression_segments = regression_segments
      self._regression_knot_dates = regression_knot_dates
  
      self.regression_rho = regression_rho
      self.flat_multiplier = flat_multiplier
  
      # set private var to arg value
      # if None set default in _set_default_args()
      self._regressor_sign = self.regressor_sign
      self._regressor_init_knot_loc = self.regressor_init_knot_loc
      self._regressor_init_knot_scale = self.regressor_init_knot_scale
      self._regressor_knot_scale = self.regressor_knot_scale
  
      self.coef_prior_list = coef_prior_list
      self._coef_prior_list = []
      self._regression_knots_idx = None
      self._num_of_regressors = 0
  
      # positive regressors
      self._num_of_positive_regressors = 0
      self._positive_regressor_col = list()
      self._positive_regressor_init_knot_loc = list()
      self._positive_regressor_init_knot_scale = list()
      self._positive_regressor_knot_scale_1d = list()
      self._positive_regressor_knot_scale = list()
      # negative regressors
      self._num_of_negative_regressors = 0
      self._negative_regressor_col = list()
      self._negative_regressor_init_knot_loc = list()
      self._negative_regressor_init_knot_scale = list()
      self._negative_regressor_knot_scale_1d = list()
      self._negative_regressor_knot_scale = list()
      # regular regressors
      self._num_of_regular_regressors = 0
      self._regular_regressor_col = list()
      self._regular_regressor_init_knot_loc = list()
      self._regular_regressor_init_knot_scale = list()
      self._regular_regressor_knot_scale_1d = list()
      self._regular_regressor_knot_scale = list()
      self._regressor_col = list()
  
      # init dynamic data attributes
      # the following are set by `_set_dynamic_attributes()` and generally set during fit()
      # from input df
      # response data
      self._is_valid_response = None
      self._which_valid_response = None
      self._num_of_valid_response = 0
  
      # regression data
      self._knots_tp_coefficients = None
      self._positive_regressor_matrix = None
      self._negative_regressor_matrix = None
      self._regular_regressor_matrix = None
  
      # other configurations
      self.date_freq = date_freq
      self.degree_of_freedom = degree_of_freedom
      self.residuals_scale_upper = residuals_scale_upper
      self._residuals_scale_upper = residuals_scale_upper
      self.ktrlite_optim_args = ktrlite_optim_args
  
      self._set_static_attributes()
      self._set_model_param_names()
  
imports: from orbit.models.ktrlite import KTRLite
  import pandas
  import numpy
  import math
  from scipy.stats import nct
  from enum import Enum
  import torch
  import matplotlib.pyplot
  from copy import deepcopy
  from ..constants.constants import KTRTimePointPriorKeys, PredictMethod, TrainingMetaKeys, PredictionMetaKeys
  from ..exceptions import IllegalArgument, ModelException, PredictionException
  from ..utils.general import is_ordered_datetime
  from ..utils.kernels import gauss_kernel, sandwich_kernel
  from ..utils.features import make_seasonal_regressors
  from .model_template import ModelTemplate
  from ..estimators.pyro_estimator import PyroEstimatorSVI
  from ..models import KTRLite
  from orbit.constants.palette import OrbitPalette
  from ..utils.knots import get_knot_idx, get_knot_dates
  from ..utils.plot import orbit_style_decorator
label_desc: Use image node_id 1 to create a new KTRModel object from inherited base classes: ModelTemplate with example: obj = KTRModel(level_knot_scale, level_segments, level_knot_distance, level_knot_dates, seasonality, seasonality_fs_order, seasonality_segments, seasonal_initial_knot_scale, seasonal_knot_scale, regressor_col, regressor_sign, regressor_init_knot_loc, regressor_init_knot_scale, regressor_knot_scale, regression_segments, regression_knot_distance, regression_knot_dates, regression_rho, degree_of_freedom, date_freq, coef_prior_list, flat_multiplier, residuals_scale_upper, ktrlite_optim_args)