code: def cross_val_metrics(
      dataset_path,
      output_path,
      config_path=None,
      nb_folds=5,
      train_size_ratio=1.0,
      exclude_slot_metrics=False,
      include_errors=False,
      verbose=0,
  ):
      import json
      import logging
      from pathlib import Path
      from snips_nlu_metrics import compute_cross_val_metrics
      from snips_nlu import SnipsNLUEngine
      from snips_nlu.cli.utils import set_nlu_logger
      from snips_nlu.common.utils import json_string
  
      if verbose == 1:
          set_nlu_logger(logging.INFO)
      elif verbose >= 2:
          set_nlu_logger(logging.DEBUG)
  
      def progression_handler(progress):
          print("%d%%" % int(progress * 100))
  
      if config_path is not None:
          with Path(config_path).open("r", encoding="utf-8") as f:
              config = json.load(f)
          engine_cls = make_engine_cls(config)
      else:
          engine_cls = SnipsNLUEngine
  
      metrics_args = dict(
          dataset=dataset_path,
          engine_class=engine_cls,
          progression_handler=progression_handler,
          nb_folds=nb_folds,
          train_size_ratio=train_size_ratio,
          include_slot_metrics=not exclude_slot_metrics,
          slot_matching_lambda=_match_trimmed_values,
      )
  
      metrics = compute_cross_val_metrics(**metrics_args)
      if not include_errors:
          metrics.pop("parsing_errors")
  
      with Path(output_path).open(mode="w", encoding="utf8") as f:
          f.write(json_string(metrics))
  
file_path: snips-nlu/snips_nlu/cli/metrics.py
imports: from __future__ import print_function, unicode_literals
label_desc: Use image node_id 4 for calling a global function with example usage: cross_val_metrics(dataset_path, output_path, config_path, nb_folds, train_size_ratio, exclude_slot_metrics, include_errors, verbose) without return types