code: def testLossFunctionChange():
      spark = test_helpers.getOrCreateSparkSession(
          test_helpers.getCurrentMethodName()
      )
      import catboost_spark
  
      dataDir = os.path.join(config.CATBOOST_TEST_DATA_DIR, "querywise")
  
      trainPool = catboost_spark.Pool.load(
          spark,
          dataPathWithScheme=os.path.join(dataDir, "train"),
          columnDescription=os.path.join(dataDir, "train.cd"),
      )
  
      regressor = (
          catboost_spark.CatBoostRegressor()
          .setIterations(20)
          .setLossFunction("QueryRMSE")
          .setTrainDir(
              tempfile.mkdtemp(
                  prefix=test_helpers.getCurrentMethodName()
              )
          )
      )
      model = regressor.fit(trainPool)
  
      calcTypes = [
          catboost_spark.ECalcTypeShapValues.Regular,
          catboost_spark.ECalcTypeShapValues.Approximate,
          catboost_spark.ECalcTypeShapValues.Exact,
      ]
  
      for calcType in calcTypes:
          featureImportancesPredictionValuesChange = (
              model.getFeatureImportance(
                  fstrType=catboost_spark.EFstrType.LossFunctionChange,
                  data=trainPool,
                  calcType=calcType,
              )
          )
          print(
              "calcType="
              + str(calcType)
              + ",featureImportancesLossFunctionChange="
          )
          print(featureImportancesPredictionValuesChange)
  
          featureImportancesDefault = model.getFeatureImportance(
              data=trainPool, calcType=calcType
          )
          print(
              "calcType="
              + str(calcType)
              + ",featureImportancesDefault="
          )
          print(featureImportancesDefault)
  
          featureImportancesPredictionValuesChangePrettified = (
              model.getFeatureImportancePrettified(
                  fstrType=catboost_spark.EFstrType.LossFunctionChange,
                  data=trainPool,
                  calcType=calcType,
              )
          )
          print(
              "calcType="
              + str(calcType)
              + ",featureImportancesLossFunctionChangePrettified="
          )
          for e in featureImportancesPredictionValuesChangePrettified:
              print(
                  "featureName={},importance={}".format(
                      e.featureName(), e.importance()
                  )
              )
  
          featureImportancesDefaultPrettified = (
              model.getFeatureImportancePrettified(
                  data=trainPool, calcType=calcType
              )
          )
          print(
              "calcType="
              + str(calcType)
              + ",featureImportancesDefaultPrettified="
          )
          for e in featureImportancesDefaultPrettified:
              print(
                  "featureName={},importance={}".format(
                      e.featureName(), e.importance()
                  )
              )
  
file_path: catboost/catboost/spark/catboost4j-spark/core/src/test/python/feature_importance_test.py
imports: import os
  import tempfile
  import config
  import test_helpers
label_desc: Use image node_id 2 for calling a global function with example usage: testLossFunctionChange() without return types