code: def test_custom_loss_function(df):
      """Tests the custom loss function argument"""
  
      def custom_loss(y_pred, y_true):
          """Root mean absolute error"""
          return np.sqrt(
              np.sum(np.abs(np.array(y_pred) - np.array(y_true)))
          )
  
      forecast = UnivariateForecast(
          df,
          train_end_date=datetime.datetime(2018, 1, 2),
          r2_loss_function=custom_loss,
      )
      assert forecast.train_evaluation[
          cst.R2_null_model_score
      ] == 1 - math.sqrt(2)
      assert forecast.test_evaluation[cst.R2_null_model_score] == 0
  
imports: import datetime
  import math
  import sys
  from functools import partial
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from pandas.testing import assert_series_equal
  from sklearn.pipeline import Pipeline
  from greykite.common import constants
  from greykite.common.evaluation import ElementwiseEvaluationMetricEnum
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import gen_sliced_df
  from greykite.framework.input.univariate_time_series import UnivariateTimeSeries
  from greykite.framework.output.univariate_forecast import UnivariateForecast
  from greykite.framework.pipeline.utils import get_forecast
  from greykite.sklearn.estimator.prophet_estimator import ProphetEstimator
  from greykite.sklearn.estimator.silverkite_estimator import SilverkiteEstimator
  from greykite.sklearn.estimator.testing_utils import params_component_breakdowns
label_desc: Use image node_id 10 for calling a global function with example usage: test_custom_loss_function(df) and returns: np