class_docstr: A class to implement change point detection.
  
  Currently supports long-term change point detection only. Input is a dataframe with time_col
  indicating the column of time info (the format should be able to be parsed by pd.to_datetime),
  and value_col indicating the column of observed time series values.
  
  Attributes
  ----------
  original_df : `pandas.DataFrame`
      The original data df, used to retrieve original observations, if aggregation is used in
      fitting change points.
  time_col : `str`
      The column name for time column.
  value_col : `str`
      The column name for value column.
  trend_potential_changepoint_n: `int`
      The number of change points that are evenly distributed over the time period.
  yearly_seasonality_order : `int`
      The yearly seasonality order used when fitting trend.
  y : `pandas.Series`
      The observations after aggregation.
  trend_df : `pandas.DataFrame`
      The augmented df of the original_df, including regressors of trend change points and
      Fourier series for yearly seasonality.
  trend_model : `sklearn.base.RegressionMixin`
      The fitted trend model.
  trend_coef : `numpy.array`
      The estimated trend coefficients.
  trend_intercept : `float`
      The estimated trend intercept.
  adaptive_lasso_coef : `list`
      The list of length two, first element is estimated trend coefficients, and second element
      is intercept, both estimated by adaptive lasso.
  trend_changepoints : `list`
      The list of detected trend change points, parsable by pd.to_datetime
  trend_estimation : `pd.Series`
      The estimated trend with detected trend change points.
  seasonality_df : `pandas.DataFrame`
      The augmented df of ``original_df``, including regressors of seasonality change points with
      different Fourier series frequencies.
  seasonality_changepoints : `dict`
      The dictionary of detected seasonality change points for each component.
      Keys are component names, and values are list of change points.
  seasonality_estimation : `pandas.Series`
      The estimated seasonality with detected seasonality change points.
      The series has the same length as ``original_df``. Index is timestamp, and values
      are the estimated seasonality at each timestamp.
      The seasonality estimation is the estimated of seasonality effect with trend estimated
      by `~greykite.algo.changepoint.adalasso.changepoints_utils.estimate_trend_with_detected_changepoints`
      removed.
  
  Methods
  -------
  find_trend_changepoints : callable
      Finds the potential trend change points for a given time series df.
  plot : callable
      Plot the results after implementing find_trend_changepoints.
docstr: Makes a plot to show the observations/estimations/change points.
  
  In this function, component parameters specify if each component in the plot is
  included or not. These are `bool` variables.
  For those components that are set to True, their values will be replaced by the
  corresponding data. Other components values will be set to None. Then these variables
  will be fed into
  `~greykite.algo.changepoint.adalasso.changepoints_utils.plot_change`
  
  Parameters
  ----------
  observation : `bool`
      Whether to include observation
  observation_original : `bool`
      Set True to plot original observations, and False to plot aggregated observations.
      No effect is ``observation`` is False
  trend_estimate : `bool`
      Set True to add trend estimation.
  trend_change : `bool`
      Set True to add change points.
  yearly_seasonality_estimate : `bool`
      Set True to add estimated yearly seasonality.
  adaptive_lasso_estimate : `bool`
      Set True to add adaptive lasso estimated trend.
  seasonality_change : `bool`
      Set True to add seasonality change points.
  seasonality_change_by_component : `bool`
      If true, seasonality changes will be plotted separately for different components,
      else all will be in the same symbol.
      No effect if ``seasonality_change`` is False
  seasonality_estimate : `bool`
      Set True to add estimated seasonality.
      The seasonality if plotted around trend, so the actual seasonality shown is
      trend estimation + seasonality estimation.
  plot : `bool`, default True
      Set to True to display the plot, and set to False to return the plotly figure object.
  
  Returns
  -------
  None (if ``plot`` == True)
      The function shows a plot.
  fig : `plotly.graph_objects.Figure`
      The plot object.
code: def plot(
      self,
      observation=True,
      observation_original=True,
      trend_estimate=True,
      trend_change=True,
      yearly_seasonality_estimate=False,
      adaptive_lasso_estimate=False,
      seasonality_change=False,
      seasonality_change_by_component=True,
      seasonality_estimate=False,
      plot=True,
  ):
      """Makes a plot to show the observations/estimations/change points.
  
      In this function, component parameters specify if each component in the plot is
      included or not. These are `bool` variables.
      For those components that are set to True, their values will be replaced by the
      corresponding data. Other components values will be set to None. Then these variables
      will be fed into
      `~greykite.algo.changepoint.adalasso.changepoints_utils.plot_change`
  
      Parameters
      ----------
      observation : `bool`
          Whether to include observation
      observation_original : `bool`
          Set True to plot original observations, and False to plot aggregated observations.
          No effect is ``observation`` is False
      trend_estimate : `bool`
          Set True to add trend estimation.
      trend_change : `bool`
          Set True to add change points.
      yearly_seasonality_estimate : `bool`
          Set True to add estimated yearly seasonality.
      adaptive_lasso_estimate : `bool`
          Set True to add adaptive lasso estimated trend.
      seasonality_change : `bool`
          Set True to add seasonality change points.
      seasonality_change_by_component : `bool`
          If true, seasonality changes will be plotted separately for different components,
          else all will be in the same symbol.
          No effect if ``seasonality_change`` is False
      seasonality_estimate : `bool`
          Set True to add estimated seasonality.
          The seasonality if plotted around trend, so the actual seasonality shown is
          trend estimation + seasonality estimation.
      plot : `bool`, default True
          Set to True to display the plot, and set to False to return the plotly figure object.
  
      Returns
      -------
      None (if ``plot`` == True)
          The function shows a plot.
      fig : `plotly.graph_objects.Figure`
          The plot object.
      """
      # Adds observation
      if observation:
          if observation_original:
              observation = self.original_df[self.value_col]
              observation.index = self.original_df[self.time_col]
          else:
              observation = self.y
      else:
          observation = None
      # Adds trend estimation
      if trend_estimate:
          trend_estimate = compute_fitted_components(
              x=self.trend_df,
              coef=self.trend_coef,
              regex="^changepoint",
              include_intercept=True,
              intercept=self.trend_intercept,
          )
      else:
          trend_estimate = None
      # Adds trend change points
      if trend_change:
          if self.trend_changepoints is None:
              warnings.warn(
                  "You haven't run trend change point detection algorithm yet. "
                  "Please call find_trend_changepoints first."
              )
          trend_change = self.trend_changepoints
      else:
          trend_change = None
      # Adds yearly seasonality estimates
      if yearly_seasonality_estimate:
          yearly_seasonality_estimate = compute_fitted_components(
              x=self.trend_df,
              coef=self.trend_coef,
              regex="^.*yearly.*$",
              include_intercept=False,
          )
      else:
          yearly_seasonality_estimate = None
      # Adds adaptive lasso trend estimates
      if (
          adaptive_lasso_estimate
          and self.adaptive_lasso_coef is not None
      ):
          adaptive_lasso_estimate = compute_fitted_components(
              x=self.trend_df,
              coef=self.adaptive_lasso_coef[1],
              regex="^changepoint",
              include_intercept=True,
              intercept=self.adaptive_lasso_coef[0],
          )
      else:
          adaptive_lasso_estimate = None
      # Adds seasonality change points
      if seasonality_change:
          if self.seasonality_changepoints is None:
              warnings.warn(
                  "You haven't run seasonality change point detection algorithm yet. "
                  "Please call find_seasonality_changepoints first."
              )
          if seasonality_change_by_component:
              seasonality_change = self.seasonality_changepoints
          else:
              seasonality_change = []
              for key in self.seasonality_changepoints.keys():
                  seasonality_change += self.seasonality_changepoints[
                      key
                  ]
      else:
          seasonality_change = None
      # Adds seasonality estimates
      if seasonality_estimate:
          if self.seasonality_estimation is None:
              warnings.warn(
                  "You haven't run seasonality change point detection algorithm yet. "
                  "Please call find_seasonality_changepoints first."
              )
              seasonality_estimate = None
          else:
              seasonality_estimate = (
                  self.seasonality_estimation + self.trend_estimation
              )
      else:
          seasonality_estimate = None
      fig = plot_change(
          observation=observation,
          trend_estimate=trend_estimate,
          trend_change=trend_change,
          year_seasonality_estimate=yearly_seasonality_estimate,
          adaptive_lasso_estimate=adaptive_lasso_estimate,
          seasonality_change=seasonality_change,
          seasonality_estimate=seasonality_estimate,
          yaxis=self.value_col,
      )
      if fig is not None and len(fig.data) > 0:
          if plot:
              fig.show()
          else:
              return fig
      else:
          warnings.warn(
              "Figure is empty, at least one component has to be true."
          )
          return None
  
imports: import warnings
  from datetime import timedelta
  from typing import List
  from typing import Optional
  import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from sklearn.base import RegressorMixin
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.linear_model import LassoCV
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import RidgeCV
  from greykite.algo.changepoint.adalasso.changepoints_utils import build_seasonality_feature_df_with_changes
  from greykite.algo.changepoint.adalasso.changepoints_utils import build_trend_feature_df_with_changes
  from greykite.algo.changepoint.adalasso.changepoints_utils import check_freq_unit_at_most_day
  from greykite.algo.changepoint.adalasso.changepoints_utils import combine_detected_and_custom_trend_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import compute_fitted_components
  from greykite.algo.changepoint.adalasso.changepoints_utils import compute_min_changepoint_index_distance
  from greykite.algo.changepoint.adalasso.changepoints_utils import estimate_seasonality_with_detected_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import estimate_trend_with_detected_changepoints
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_changepoint_dates_from_changepoints_dict
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_seasonality_changes_from_adaptive_lasso
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_trend_changes_from_adaptive_lasso
  from greykite.algo.changepoint.adalasso.changepoints_utils import get_yearly_seasonality_changepoint_dates_from_freq
  from greykite.algo.changepoint.adalasso.changepoints_utils import plot_change
  from greykite.algo.changepoint.shift_detection.shift_detector import ShiftDetection
  from greykite.common.constants import TimeFeaturesEnum
  from greykite.common.features.timeseries_features import get_evenly_spaced_changepoints_dates
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
  from greykite.common.logging import pprint
  from greykite.common.python_utils import ignore_warnings
label_desc: Use image node_id 4 for calling the ChangepointDetector obj's underlying member method code with example usage: obj.plot(observation, observation_original, trend_estimate, trend_change, yearly_seasonality_estimate, adaptive_lasso_estimate, seasonality_change, seasonality_change_by_component, seasonality_estimate, plot) and returns: None, fig