class_docstr: Prophet forecaster.
  
  Parameters
  ----------
  growth: String 'linear', 'logistic' or 'flat' to specify a linear, logistic or
      flat trend.
  changepoints: List of dates at which to include potential changepoints. If
      not specified, potential changepoints are selected automatically.
  n_changepoints: Number of potential changepoints to include. Not used
      if input `changepoints` is supplied. If `changepoints` is not supplied,
      then n_changepoints potential changepoints are selected uniformly from
      the first `changepoint_range` proportion of the history.
  changepoint_range: Proportion of history in which trend changepoints will
      be estimated. Defaults to 0.8 for the first 80%. Not used if
      `changepoints` is specified.
  yearly_seasonality: Fit yearly seasonality.
      Can be 'auto', True, False, or a number of Fourier terms to generate.
  weekly_seasonality: Fit weekly seasonality.
      Can be 'auto', True, False, or a number of Fourier terms to generate.
  daily_seasonality: Fit daily seasonality.
      Can be 'auto', True, False, or a number of Fourier terms to generate.
  holidays: pd.DataFrame with columns holiday (string) and ds (date type)
      and optionally columns lower_window and upper_window which specify a
      range of days around the date to be included as holidays.
      lower_window=-2 will include 2 days prior to the date as holidays. Also
      optionally can have a column prior_scale specifying the prior scale for
      that holiday.
  seasonality_mode: 'additive' (default) or 'multiplicative'.
  seasonality_prior_scale: Parameter modulating the strength of the
      seasonality model. Larger values allow the model to fit larger seasonal
      fluctuations, smaller values dampen the seasonality. Can be specified
      for individual seasonalities using add_seasonality.
  holidays_prior_scale: Parameter modulating the strength of the holiday
      components model, unless overridden in the holidays input.
  changepoint_prior_scale: Parameter modulating the flexibility of the
      automatic changepoint selection. Large values will allow many
      changepoints, small values will allow few changepoints.
  mcmc_samples: Integer, if greater than 0, will do full Bayesian inference
      with the specified number of MCMC samples. If 0, will do MAP
      estimation.
  interval_width: Float, width of the uncertainty intervals provided
      for the forecast. If mcmc_samples=0, this will be only the uncertainty
      in the trend using the MAP estimate of the extrapolated generative
      model. If mcmc.samples>0, this will be integrated over all model
      parameters, which will include uncertainty in seasonality.
  uncertainty_samples: Number of simulated draws used to estimate
      uncertainty intervals. Settings this value to 0 or False will disable
      uncertainty estimation and speed up the calculation.
  stan_backend: str as defined in StanBackendEnum default: None - will try to
      iterate over all available backends and find the working one
  holidays_mode: 'additive' or 'multiplicative'. Defaults to seasonality_mode.
class_docstr_tok: ["Prophet","forecaster",".","Parameters","--","--","--","--","--","growth",":","String","'linear","'",",","'logistic","'","or","'flat","'","to","specify","a","linear",",","logistic","or","flat","trend",".","changepoints",":","List","of","dates","at","which","to","include","potential","changepoints",".","If","not","specified",",","potential","changepoints","are","selected","automatically",".","n_changepoints",":","Number","of","potential","changepoints","to","include",".","Not","used","if","input","`","changepoints","`","is","supplied",".","If","`","changepoints","`","is","not","supplied",",","then","n_changepoints","potential","changepoints","are","selected","uniformly","from","the","first","`","changepoint_range","`","proportion","of","the","history",".","changepoint_range",":","Proportion","of","history","in","which","trend","changepoints","will","be","estimated",".","Defaults","to","0.8","for","the","first","80","%",".","Not","used","if","`","changepoints","`","is","specified",".","yearly_seasonality",":","Fit","yearly","seasonality",".","Can","be","'auto","'",",","True",",","False",",","or","a","number","of","Fourier","terms","to","generate",".","weekly_seasonality",":","Fit","weekly","seasonality",".","Can","be","'auto","'",",","True",",","False",",","or","a","number","of","Fourier","terms","to","generate",".","daily_seasonality",":","Fit","daily","seasonality",".","Can","be","'auto","'",",","True",",","False",",","or","a","number","of","Fourier","terms","to","generate",".","holidays",":","pd.DataFrame","with","columns","holiday","(","string",")","and","ds","(","date","type",")","and","optionally","columns","lower_window","and","upper_window","which","specify","a","range","of","days","around","the","date","to","be","included","as","holidays",".","lower_window=-2","will","include","2","days","prior","to","the","date","as","holidays",".","Also","optionally","can","have","a","column","prior_scale","specifying","the","prior","scale","for","that","holiday",".","seasonality_mode",":","'additive","'","(","default",")","or","'multiplicative","'",".","seasonality_prior_scale",":","Parameter","modulating","the","strength","of","the","seasonality","model",".","Larger","values","allow","the","model","to","fit","larger","seasonal","fluctuations",",","smaller","values","dampen","the","seasonality",".","Can","be","specified","for","individual","seasonalities","using","add_seasonality",".","holidays_prior_scale",":","Parameter","modulating","the","strength","of","the","holiday","components","model",",","unless","overridden","in","the","holidays","input",".","changepoint_prior_scale",":","Parameter","modulating","the","flexibility","of","the","automatic","changepoint","selection",".","Large","values","will","allow","many","changepoints",",","small","values","will","allow","few","changepoints",".","mcmc_samples",":","Integer",",","if","greater","than","0",",","will","do","full","Bayesian","inference","with","the","specified","number","of","MCMC","samples",".","If","0",",","will","do","MAP","estimation",".","interval_width",":","Float",",","width","of","the","uncertainty","intervals","provided","for","the","forecast",".","If","mcmc_samples=0",",","this","will","be","only","the","uncertainty","in","the","trend","using","the","MAP","estimate","of","the","extrapolated","generative","model",".","If","mcmc.samples",">","0",",","this","will","be","integrated","over","all","model","parameters",",","which","will","include","uncertainty","in","seasonality",".","uncertainty_samples",":","Number","of","simulated","draws","used","to","estimate","uncertainty","intervals",".","Settings","this","value","to","0","or","False","will","disable","uncertainty","estimation","and","speed","up","the","calculation",".","stan_backend",":","str","as","defined","in","StanBackendEnum","default",":","None","-","will","try","to","iterate","over","all","available","backends","and","find","the","working","one","holidays_mode",":","'additive","'","or","'multiplicative","'",".","Defaults","to","seasonality_mode","."]
docstr: Vectorizes prophet's logistic uncertainty by creating a matrix of future possible trends.
  
  Parameters
  ----------
  mat: A trend shift matrix returned by _make_trend_shift_matrix()
  deltas: The size of the trend changes at each changepoint, estimated by the model
  k: Float initial rate.
  m: Float initial offset.
  cap: np.array of capacities at each t.
  t_time: The values of t in the model context (i.e. scaled so that anything > 1 represents the future)
  n_length: For each path, the number of future steps to simulate
  single_diff: The difference between each t step in the model context. Default None, inferred
      from t_time.
  
  Returns
  -------
  A numpy array with shape (n_samples, n_length), representing the width of the uncertainty interval
  (standardized, not on the same scale as the actual data values) around 0.
code: def _logistic_uncertainty(
      self,
      mat: np.ndarray,
      deltas: np.ndarray,
      k: float,
      m: float,
      cap: np.ndarray,
      t_time: np.ndarray,
      n_length: int,
      single_diff: float = None,
  ) -> np.ndarray:
      """
      Vectorizes prophet's logistic uncertainty by creating a matrix of future possible trends.
  
      Parameters
      ----------
      mat: A trend shift matrix returned by _make_trend_shift_matrix()
      deltas: The size of the trend changes at each changepoint, estimated by the model
      k: Float initial rate.
      m: Float initial offset.
      cap: np.array of capacities at each t.
      t_time: The values of t in the model context (i.e. scaled so that anything > 1 represents the future)
      n_length: For each path, the number of future steps to simulate
      single_diff: The difference between each t step in the model context. Default None, inferred
          from t_time.
  
      Returns
      -------
      A numpy array with shape (n_samples, n_length), representing the width of the uncertainty interval
      (standardized, not on the same scale as the actual data values) around 0.
      """
  
      def ffill(arr):
          mask = arr == 0
          idx = np.where(~mask, np.arange(mask.shape[1]), 0)
          np.maximum.accumulate(idx, axis=1, out=idx)
          return arr[np.arange(idx.shape[0])[:, None], idx]
  
      # for logistic growth we need to evaluate the trend all the way from the start of the train item
      historical_mat, historical_time = self._make_historical_mat_time(
          deltas, self.changepoints_t, t_time, len(mat), single_diff
      )
      mat = np.concatenate([historical_mat, mat], axis=1)
      full_t_time = np.concatenate([historical_time, t_time])
  
      # apply logistic growth logic on the slope changes
      k_cum = np.concatenate(
          (
              np.ones((mat.shape[0], 1)) * k,
              np.where(mat, np.cumsum(mat, axis=1) + k, 0),
          ),
          axis=1,
      )
      k_cum_b = ffill(k_cum)
      gammas = np.zeros_like(mat)
      for i in range(mat.shape[1]):
          x = full_t_time[i] - m - np.sum(gammas[:, :i], axis=1)
          ks = 1 - k_cum_b[:, i] / k_cum_b[:, i + 1]
          gammas[:, i] = x * ks
      # the data before the -n_length is the historical values, which are not needed, so cut the last n_length
      k_t = (mat.cumsum(axis=1) + k)[:, -n_length:]
      m_t = (gammas.cumsum(axis=1) + m)[:, -n_length:]
      sample_trends = cap / (1 + np.exp(-k_t * (t_time - m_t)))
      # remove the mean because we only need width of the uncertainty centered around 0
      # we will add the width to the main forecast - yhat (which is the mean) - later
      return sample_trends - sample_trends.mean(axis=0)
  
imports: from __future__ import absolute_import, division, print_function
  import dataclasses
  import logging
  from collections import OrderedDict, defaultdict
  from copy import deepcopy
  from datetime import timedelta
  from typing import Dict, List, Union
  import numpy
  import pandas
  from numpy.typing import NDArray
  from prophet.make_holidays import get_holiday_names, make_holidays_df
  from prophet.models import StanBackendEnum, ModelInputData, ModelParams, TrendIndicator
  from prophet.plot import plot, plot_components
label_desc: Use image node_id 41 for calling the Prophet obj's underlying member method code with example usage: obj._logistic_uncertainty(mat, deltas, k, m, cap, t_time, n_length, single_diff) and returns: unknown, arr