code: def test_silverkite_with_components_daily_data(
      expected_component_names,
  ):
      """Tests ``plot_components`` with daily data and missing input values."""
      daily_data = generate_df_with_reg_for_tests(
          freq="D",
          periods=35,
          train_start_date=datetime.datetime(2018, 1, 1),
          conti_year_origin=2018,
      )
      train_df = daily_data["train_df"].copy()
      train_df.loc[
          [2, 4, 7], cst.VALUE_COL
      ] = np.nan  # creates missing values
  
      params_daily = (
          params_components()
      )  # SilverkiteEstimator parameters
      # converts into parameters for `forecast_silverkite`
      coverage = params_daily.pop("coverage")
      # removes daily seasonality terms
      params_daily["fs_components_df"] = pd.DataFrame(
          {
              "name": ["tow", "ct1"],
              "period": [7.0, 1.0],
              "order": [4, 5],
              "seas_names": ["weekly", "yearly"],
          }
      )
  
      model = BaseSilverkiteEstimator(
          coverage=coverage,
          uncertainty_dict=params_daily["uncertainty_dict"],
      )
  
      with pytest.raises(
          NotFittedError,
          match="Call `fit` before calling `plot_components`.",
      ):
          model.plot_components()
  
      with pytest.warns(Warning):
          # suppress warnings from conf_interval.py and sklearn
          # a subclass's `fit()` method will have these steps
          model.fit(
              X=train_df, time_col=cst.TIME_COL, value_col=cst.VALUE_COL
          )
          silverkite = SilverkiteForecast()
          model.model_dict = silverkite.forecast(
              df=train_df,
              time_col=cst.TIME_COL,
              value_col=cst.VALUE_COL,
              **params_daily,
          )
          model.finish_fit()
  
      # Tests `plot_components`
      title = "Custom component plot"
      fig = model.plot_components(title=title)
      expected_rows = 10
      assert len(fig.data) == expected_rows  # includes changepoints
      assert all(
          [
              fig.data[i].name in expected_component_names
              for i in range(expected_rows)
          ]
      )
      assert fig.layout.xaxis.title["text"] == "Date"
      assert fig.layout.title["text"] == title
      assert fig.layout.title["x"] == 0.5
  
      with pytest.raises(ValueError, match="Call the predict"):
          model.plot_components(predict_phase=True)
  
      # Tests `plot_components(predict_phase=True)`
      _ = model.predict(X=daily_data["test_df"])
      fig = model.plot_components(predict_phase=True)
      expected_rows = 6
      assert len(fig.data) == expected_rows  # includes changepoints
      assert all(
          [
              fig.data[i].name in expected_component_names
              for i in range(expected_rows)
          ]
      )
      assert fig.layout.xaxis.title["text"] == "Date"
      assert fig.layout.title["text"] == "Component Plot - Predicted"
      assert fig.layout.title["x"] == 0.5
  
      # Tests `plot_components(predict_phase=True)` with gap
      _ = model.predict(X=daily_data["test_df"].iloc[4:, :])
      fig = model.plot_components(predict_phase=True)
      expected_rows = 6
      assert len(fig.data) == expected_rows  # includes changepoints
      assert all(
          [
              fig.data[i].name in expected_component_names
              for i in range(expected_rows)
          ]
      )
      assert fig.layout.xaxis.title["text"] == "Date"
      assert fig.layout.title["text"] == "Component Plot - Predicted"
      assert fig.layout.title["x"] == 0.5
  
      # Tests inputs to `plot_components`
      with pytest.raises(
          TypeError, match="center_components must be bool: True/False"
      ):
          model.plot_components(center_components="Yes please")
  
      with pytest.raises(ValueError, match="Choose denominator from"):
          model.plot_components(denominator="Abs_Y")
  
      with pytest.raises(
          TypeError, match="grouping_regex_patterns_dict must be"
      ):
          model.plot_components(grouping_regex_patterns_dict=[])
  
      with pytest.raises(
          ValueError, match="grouping_regex_patterns_dict must be"
      ):
          model.plot_components(grouping_regex_patterns_dict={})
  
      # Component plot error if `fit_algorithm` is "rf" or "gradient_boosting"
      params_daily["fit_algorithm"] = "rf"
      model = BaseSilverkiteEstimator(
          coverage=coverage,
          uncertainty_dict=params_daily["uncertainty_dict"],
      )
      with pytest.warns(Warning):
          # suppress warnings from conf_interval.py and sklearn
          # a subclass's `fit()` method will have these steps
          model.fit(
              X=train_df, time_col=cst.TIME_COL, value_col=cst.VALUE_COL
          )
          model.model_dict = silverkite.forecast(
              df=train_df,
              time_col=cst.TIME_COL,
              value_col=cst.VALUE_COL,
              **params_daily,
          )
          model.finish_fit()
      assert model.coef_ is None
      with pytest.raises(
          NotImplementedError,
          match="Component plot has only been implemented for additive linear models.",
      ):
          model.plot_components()
  
imports: import datetime
  import numpy
  import pandas
  import pytest
  from sklearn.exceptions import NotFittedError
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_squared_error
  from testfixtures import LogCapture
  import greykite.common.constants
  from greykite.algo.forecast.silverkite.forecast_silverkite import SilverkiteForecast
  from greykite.common.data_loader import DataLoader
  from greykite.common.features.timeseries_features import convert_date_to_continuous_time
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import daily_data_reg
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils import generate_df_with_reg_for_tests
  from greykite.sklearn.estimator.base_silverkite_estimator import BaseSilverkiteEstimator
  from greykite.sklearn.estimator.testing_utils import params_component_breakdowns
  from greykite.sklearn.estimator.testing_utils import params_components
label_desc: Use image node_id 14 for calling a global function with example usage: test_silverkite_with_components_daily_data(expected_component_names) without return types