code: def test_fit_ml_model_with_evaluation_nan():
      """Tests if NaNs are dropped before fitting."""
      df = pd.DataFrame(
          {
              "a": [1, 2, 3, 2],
              "b": [1, 3, 1, 2],
              "c": ["a", "b", "a", "b"],
          }
      )
      df = pd.get_dummies(df)
      df["y"] = [1, 5, np.nan, 3]
      model_formula_str = "y~a+b+c_a+c_b"
      with pytest.raises(
          ValueError,
          match="Model training requires at least 3 observations",
      ):
          fit_ml_model_with_evaluation(
              df=df.head(3),
              model_formula_str=model_formula_str,
              training_fraction=1.0,
          )
  
      with pytest.warns(UserWarning) as record:
          trained_model = fit_ml_model_with_evaluation(
              df=df,
              model_formula_str=model_formula_str,
              training_fraction=1.0,
          )
          assert (
              "The data frame included 1 row(s) with NAs which were removed for model fitting."
              in record[0].message.args[0]
          )
          # Since the design matrix is singular, variance scaling is skipped.
          assert "Zero degrees of freedom" in record[1].message.args[0]
          assert trained_model["sigma_scaler"] is None
          assert (
              trained_model["x_mean"] is None
          )  # When the model is linear, `"x_mean"` is `None`.
          assert (
              trained_model["h_mat"].shape
              == trained_model["x_mat"].shape[::-1]
          )
          assert_equal(trained_model["y"], df["y"].loc[(0, 1, 3),])
  
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 31 for calling a global function with example usage: test_fit_ml_model_with_evaluation_nan() without return types