code: def test_fit_ml_model_normalization():
      """Tests ``fit_ml_model`` with and without normalization"""
  
      np.random.seed(seed=123)
      n = 1000
      x1 = np.random.normal(loc=0.0, scale=1.0, size=n)
      x2 = np.random.normal(loc=0.0, scale=1.0, size=n)
      y = 3 + 2 * x1 - 2 * x2
      x1_range_length = max(x1) - min(x1)
      x2_range_length = max(x2) - min(x2)
      y_mean = y.mean()
      y = y - y_mean
  
      df = pd.DataFrame({"y": y, "x1": x1, "x2": x2})
      model_formula_str = "y ~ x1 + x2"
  
      # without normalization
      trained_model = fit_ml_model(
          df=df,
          model_formula_str=model_formula_str,
          fit_algorithm="linear",
          normalize_method=None,
      )
  
      ml_model_summary = trained_model["ml_model_summary"].round()
      obtained_coefs = np.array(ml_model_summary["coef"].round())
      expected_coefs = np.array([0, 2, -2])
      assert np.array_equal(obtained_coefs, expected_coefs)
  
      # with normalization
      trained_model = fit_ml_model(
          df=df,
          model_formula_str=model_formula_str,
          fit_algorithm="linear",
          normalize_method="zero_to_one",
      )
  
      ml_model_summary = trained_model["ml_model_summary"].round()
      obtained_coefs = np.array(ml_model_summary["coef"].round())
      # Because first we subtract the mean of y from y, which does not necessarily equal to
      # the original intercept, and second in normalizing, we subtract the min values from each x,
      # an intercept is brought in, which equals
      # (original_intercept - y_mean) + beta_1 * x1_min + beta_2 * x2_min
      expected_intercept = 3 - y_mean + 2 * x1.min() - 2 * x2.min()
      # since normalization divides variables by their range (max - min)
      # we expect the regression coefficients to be multilpied by that value
      expected_coefs = np.array(
          [
              expected_intercept,
              2 * x1_range_length,
              -2 * x2_range_length,
          ]
      ).round()
  
      assert np.array_equal(obtained_coefs, expected_coefs)
  
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 17 for calling a global function with example usage: test_fit_ml_model_normalization() without return types