class_docstr: A class to infer appropriate Fourier series orders in different
  seasonality components.
  
  The method allows users to:
  
      - optionally remove the trend with different methods.
        Available methods are in `TrendAdjustMethodEnum`.
      - optionally do an aggregation.
      - fits the seasonality component with different Fourier series orders.
      - calculates the AIC/BIC of the fits.
      - choose the most appropriate order with AIC or BIC and an optional tolerance.
      - plot the investigations.
  
  Attributes
  ----------
  df : `pandas.DataFrame` or None
      The input timeseries.
  time_col : `str` or None
      The column name for timestamps in ``df``.
  value_col : `str` or None
      The column name for values in ``df``.
  fourier_series_orders : `dict` or None
      The inferred Fourier series orders.
      The keys are the seasonality component names.
      The values are the inferred best orders according to the config.
  df_features : `pandas.DataFrame` or None
      The cached dataframe with time features.
      Building this df is slow for large dataset.
      We cache it the first time we build it for subsequent uses.
docstr: Makes a figure that contains 2-3 subplots.
  The subplots are:
  
      - AIC/BIC vs. Fourier series orders.
      - De-trended and aggregated time series vs fitted curves with best AIC/BICs.
      - (Optional) the original time series, the fitted trend and the de-trended and aggregated
        time series.
  
  Parameters
  ----------
  df : `pandas.DataFrame`
      The input time series after de-trend and aggregation.
  df_features : `pandas.DataFrame`
      The time series with seasonality features generated.
  model_class : `any`
      The class type for the model to fit the seasonality curve.
  time_col : `str`
      The column name for timestamps in ``df``.
  value_col : `str`
      The column name for values in ``df``.
  orders : `list` [`int`]
      The orders used in calculating ``aics`` and ``bics``.
  aics : `list` [`float`]
      The AICs corresponding to ``orders``.
  bics : `list` [`float`]
      The BICs corresponding to ``orders``.
  best_aic_order : `int`
      The best AIC order.
  best_bic_order : `int
      The best BIC order.
  
  Returns
  -------
  fig : `plotly.graph_object.Figure`
      The figure object.
docstr_tok: ["Makes","a","figure","that","contains","2-3","subplots",".","The","subplots","are",":","-","AIC\/BIC","vs.","Fourier","series","orders",".","-","De-trended","and","aggregated","time","series","vs","fitted","curves","with","best","AIC\/BICs",".","-","(","Optional",")","the","original","time","series",",","the","fitted","trend","and","the","de-trended","and","aggregated","time","series",".","Parameters","--","--","--","--","--","df",":","`","pandas.DataFrame","`","The","input","time","series","after","de-trend","and","aggregation",".","df_features",":","`","pandas.DataFrame","`","The","time","series","with","seasonality","features","generated",".","model_class",":","`","any","`","The","class","type","for","the","model","to","fit","the","seasonality","curve",".","time_col",":","`","str","`","The","column","name","for","timestamps","in","``","df","``",".","value_col",":","`","str","`","The","column","name","for","values","in","``","df","``",".","orders",":","`","list","`","[","`","int","`","]","The","orders","used","in","calculating","``","aics","``","and","``","bics","``",".","aics",":","`","list","`","[","`","float","`","]","The","AICs","corresponding","to","``","orders","``",".","bics",":","`","list","`","[","`","float","`","]","The","BICs","corresponding","to","``","orders","``",".","best_aic_order",":","`","int","`","The","best","AIC","order",".","best_bic_order",":","`","int","The","best","BIC","order",".","Returns","--","--","--","-","fig",":","`","plotly.graph_object.Figure","`","The","figure","object","."]
code: def _make_plot(
      self,
      df: pd.DataFrame,
      df_features: pd.DataFrame,
      model_class: any,
      time_col: str,
      value_col: str,
      orders: List[int],
      aics: List[float],
      bics: List[float],
      best_aic_order: int,
      best_bic_order: int,
  ) -> go.Figure:
      """Makes a figure that contains 2-3 subplots.
      The subplots are:
  
          - AIC/BIC vs. Fourier series orders.
          - De-trended and aggregated time series vs fitted curves with best AIC/BICs.
          - (Optional) the original time series, the fitted trend and the de-trended and aggregated
            time series.
  
      Parameters
      ----------
      df : `pandas.DataFrame`
          The input time series after de-trend and aggregation.
      df_features : `pandas.DataFrame`
          The time series with seasonality features generated.
      model_class : `any`
          The class type for the model to fit the seasonality curve.
      time_col : `str`
          The column name for timestamps in ``df``.
      value_col : `str`
          The column name for values in ``df``.
      orders : `list` [`int`]
          The orders used in calculating ``aics`` and ``bics``.
      aics : `list` [`float`]
          The AICs corresponding to ``orders``.
      bics : `list` [`float`]
          The BICs corresponding to ``orders``.
      best_aic_order : `int`
          The best AIC order.
      best_bic_order : `int
          The best BIC order.
  
      Returns
      -------
      fig : `plotly.graph_object.Figure`
          The figure object.
      """
      rows = 2
      subtitles = (
          "Criteria vs. Fourier series orders",
          "Fitted seasonality on best orders",
      )
      # If both original df and trend adjusted df are available,
      # we include the trend adjustment visualization, too.
      if (
          self.df is not None
          and time_col in self.df
          and value_col in self.df
          and self.FITTED_TREND_COL in df
      ):
          rows += 1
          subtitles += (
              "Original time series and detrended/aggregated time series",
          )
      fig = make_subplots(
          rows=rows,
          cols=1,
          subplot_titles=subtitles,
          vertical_spacing=0.1,
      )
      # Adds metric plot.
      metrics = {
          "AIC": [aics, best_aic_order, "dash"],
          "BIC": [bics, best_bic_order, None],
      }
      for i, (metric, value) in enumerate(metrics.items()):
          fig.add_trace(
              go.Scatter(
                  x=orders,
                  y=value[0],
                  name=metric,
                  mode="lines",
                  showlegend=True,
                  line=dict(
                      color=DEFAULT_PLOTLY_COLORS[i], dash=value[2]
                  ),
              ),
              row=1,
              col=1,
          )
          fig.add_vline(
              x=value[1],
              name=f"best_{metric}_order",
              line=dict(color=DEFAULT_PLOTLY_COLORS[i], dash=value[2]),
          )
      # Adds fit plot.
      fig.add_trace(
          go.Scatter(
              x=df[time_col],
              y=df[value_col],
              name="Timeseries",
              showlegend=True,
              line=dict(color="black"),
          ),
          row=2,
          col=1,
      )
      best_orders = {
          "best_AIC_order_fit": best_aic_order,
          "best_BIC_order_fit": best_bic_order,
      }
      for i, (name, order) in enumerate(best_orders.items()):
          model = model_class()
          features = [
              col
              for col in df_features.columns
              if col != value_col
              # After split, the 1st element is sin{order} or cos{order}.
              # Takes the order to compare with the current order.
              and int(col.split("_")[0][3:]) <= order
          ]
          if order > 0:
              model.fit(df_features[features], df_features[value_col])
              pred = model.predict(df_features[features])
          else:
              pred = np.repeat(
                  [df_features[value_col].mean()], len(df_features)
              )
          fig.add_trace(
              go.Scatter(
                  x=df[time_col],
                  y=pred,
                  name=name,
                  mode="lines",
                  showlegend=True,
                  line=dict(color=DEFAULT_PLOTLY_COLORS[2 + i]),
              ),
              row=2,
              col=1,
          )
  
      # Adds trend adjustment plot.
      if rows == 3:
          fig.add_trace(
              go.Scatter(
                  x=self.df[time_col],
                  y=self.df[value_col],
                  name="Original time series",
                  mode="lines",
                  showlegend=True,
              ),
              row=3,
              col=1,
          )
          fig.add_trace(
              go.Scatter(
                  x=df[time_col],
                  y=df[value_col],
                  name="Detrend/aggregated time series",
                  mode="lines",
                  showlegend=True,
                  line=dict(color="black"),
              ),
              row=3,
              col=1,
          )
          fig.add_trace(
              go.Scatter(
                  x=df[time_col],
                  y=df[self.FITTED_TREND_COL],
                  name="Fitted trend",
                  mode="lines",
                  showlegend=True,
              ),
              row=3,
              col=1,
          )
  
      fig.update_xaxes(title_text="Fourier series order", row=1, col=1)
      fig.update_xaxes(title_text="Timestamp", row=2, col=1)
      fig.update_yaxes(title_text="Criteria", row=1, col=1)
      fig.update_yaxes(title_text="Timeseries", row=2, col=1)
      if rows == 3:
          fig.update_xaxes(title_text="Timestamp", row=3, col=1)
          fig.update_yaxes(title_text="Timeseries", row=3, col=1)
      fig.update_layout(
          title_text="Inferred seasonality Fourier series orders",
          height=1000,
      )
      return fig
  
imports: from dataclasses import dataclass
  from enum import Enum
  from typing import List
  from typing import Optional
  import numpy
  import pandas
  from plotly import graph_objs
  from plotly.colors import DEFAULT_PLOTLY_COLORS
  from plotly.subplots import make_subplots
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import RidgeCV
  from sklearn.linear_model import SGDRegressor
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.constants import TimeFeaturesEnum
  from greykite.common.features.timeseries_features import add_time_features_df
  from greykite.common.features.timeseries_features import fourier_series_multi_fcn
  from greykite.common.features.timeseries_features import get_default_origin_for_time_vars
label_desc: Use image node_id 8 for calling the SeasonalityInferrer obj's underlying member method code with example usage: obj._make_plot(df, df_features, model_class, time_col, value_col, orders, aics, bics, best_aic_order, best_bic_order) and returns: fig