code: def compute_fitted_components(
      x, coef, regex, include_intercept, intercept=None
  ):
      """Computes the fitted values with selected regressors indicated by ``regex``
  
      Parameters
      ----------
      x : `pandas.DataFrame`
          The design matrix df with conventional column names.
      coef : `numpy.array`
          Estimated coefficients.
      regex : regular expression
          Pattern of the names of the columns to be used.
      include_intercept : bool
          Whether to include intercept.
      intercept : `float`
          The estimated intercept, must be provided if ``include_intercept`` == True.
  
      Returns
      -------
      result: `pandas.Series`
          The estimated component from selected regressors.
      """
      if include_intercept and intercept is None:
          raise ValueError(
              "``intercept`` must be provided when ``include_intercept`` is True."
          )
      columns = list(x.columns)
      selected_columns = get_pattern_cols(columns, regex)
      selected_columns_idx = [
          columns.index(col) for col in selected_columns
      ]
      selected_coef = coef[selected_columns_idx]
      component = x[selected_columns].dot(selected_coef)
      if include_intercept:
          component += intercept
      return component
  
imports: import warnings
  from datetime import timedelta
  import numpy
  import pandas
  import plotly.graph_objects
  from pandas.plotting import register_matplotlib_converters
  from pandas.tseries.frequencies import to_offset
  from sklearn.linear_model import Lasso
  from sklearn.linear_model import LassoCV
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import RidgeCV
  from greykite.common.constants import CHANGEPOINT_COL_PREFIX
  from greykite.common.constants import TimeFeaturesEnum
  from greykite.common.features.timeseries_features import add_time_features_df
  from greykite.common.features.timeseries_features import build_time_features_df
  from greykite.common.features.timeseries_features import fourier_series_multi_fcn
  from greykite.common.features.timeseries_features import get_changepoint_dates_from_changepoints_dict
  from greykite.common.features.timeseries_features import get_changepoint_features
  from greykite.common.features.timeseries_features import get_changepoint_features_and_values_from_config
  from greykite.common.features.timeseries_features import get_default_origin_for_time_vars
  from greykite.common.python_utils import get_pattern_cols
  from greykite.common.python_utils import unique_elements_in_list
label_desc: Use image node_id 5 for calling a global function with example usage: compute_fitted_components(x, coef, regex, include_intercept, intercept) and returns: component