code: def test_fit_model_via_design_matrix(design_mat_info):
      """Tests fit_model_via_design_matrix"""
      x_train = design_mat_info["x_mat"]
      y_train = design_mat_info["y"]
      sample_weight = np.array([1, 2, 3, 4, 5])
  
      # Linear
      ml_model = fit_model_via_design_matrix(
          x_train=x_train, y_train=y_train, fit_algorithm="linear"
      )
  
      assert ml_model.coef_[0].round() == 10.0
      assert np.round(ml_model.intercept_, 1) == 0.0
  
      # Ridge without weights
      ml_model = fit_model_via_design_matrix(
          x_train=x_train,
          y_train=y_train,
          fit_algorithm="ridge",
          sample_weight=None,
      )
  
      assert ml_model.coef_[0].round() == 0.0
      assert np.round(ml_model.intercept_, 1) == 10.0
  
      # Ridge with weights
      ml_model = fit_model_via_design_matrix(
          x_train=x_train,
          y_train=y_train,
          fit_algorithm="ridge",
          sample_weight=sample_weight,
      )
  
      assert ml_model.coef_[0].round() == 0.0
      assert np.round(ml_model.intercept_, 1) == 10.0
  
      # statsmodels_wls with weights
      ml_model = fit_model_via_design_matrix(
          x_train=x_train,
          y_train=y_train,
          fit_algorithm="statsmodels_wls",
          sample_weight=sample_weight,
      )
  
      assert ml_model.coef_[0].round() == 10.0
      assert np.round(ml_model.intercept_, 1) == 0.0
  
      with pytest.raises(
          ValueError, match="sample weights are passed."
      ):
          fit_model_via_design_matrix(
              x_train=x_train,
              y_train=y_train,
              fit_algorithm="lasso",
              sample_weight=sample_weight,
          )
  
imports: import warnings
  import numpy
  import pandas
  import pytest
  import scipy
  from pandas.testing import assert_frame_equal
  from patsy import dmatrices
  from greykite.algo.common.ml_models import breakdown_regression_based_prediction
  from greykite.algo.common.ml_models import design_mat_from_formula
  from greykite.algo.common.ml_models import fit_ml_model
  from greykite.algo.common.ml_models import fit_ml_model_with_evaluation
  from greykite.algo.common.ml_models import fit_model_via_design_matrix
  from greykite.algo.common.ml_models import get_h_mat
  from greykite.algo.common.ml_models import get_intercept_col_from_design_mat
  from greykite.algo.common.ml_models import predict_ml
  from greykite.algo.common.ml_models import predict_ml_with_uncertainty
  from greykite.algo.uncertainty.conditional.conf_interval import predict_ci
  from greykite.common.constants import ERR_STD_COL
  from greykite.common.constants import QUANTILE_SUMMARY_COL
  from greykite.common.constants import TimeFeaturesEnum
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.evaluation import calc_pred_err
  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_fourier_col_name
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import gen_sliced_df
label_desc: Use image node_id 7 for calling a global function with example usage: test_fit_model_via_design_matrix(design_mat_info) without return types