code: def ablation_pipeline(
      datasets: Union[str, List[str]],
      directory: Union[str, pathlib.Path],
      models: Union[str, List[str]],
      losses: Union[str, List[str]],
      optimizers: Union[str, List[str]],
      training_loops: Union[str, List[str]],
      *,
      epochs: Optional[int] = None,
      create_inverse_triples: Union[bool, List[bool]] = False,
      regularizers: Union[None, str, List[str]] = None,
      negative_sampler: Union[str, None] = None,
      evaluator: Optional[str] = None,
      stopper: Optional[str] = "NopStopper",
      model_to_model_kwargs: Optional[Mapping2D] = None,
      model_to_model_kwargs_ranges: Optional[Mapping2D] = None,
      model_to_loss_to_loss_kwargs: Optional[Mapping3D] = None,
      model_to_loss_to_loss_kwargs_ranges: Optional[Mapping3D] = None,
      model_to_optimizer_to_optimizer_kwargs: Optional[
          Mapping3D
      ] = None,
      model_to_optimizer_to_optimizer_kwargs_ranges: Optional[
          Mapping3D
      ] = None,
      model_to_negative_sampler_to_negative_sampler_kwargs: Optional[
          Mapping3D
      ] = None,
      model_to_negative_sampler_to_negative_sampler_kwargs_ranges: Optional[
          Mapping3D
      ] = None,
      model_to_training_loop_to_training_loop_kwargs: Optional[
          Mapping3D
      ] = None,
      model_to_training_loop_to_training_kwargs: Optional[
          Mapping3D
      ] = None,
      model_to_training_loop_to_training_kwargs_ranges: Optional[
          Mapping3D
      ] = None,
      model_to_regularizer_to_regularizer_kwargs: Optional[
          Mapping3D
      ] = None,
      model_to_regularizer_to_regularizer_kwargs_ranges: Optional[
          Mapping3D
      ] = None,
      evaluator_kwargs: Optional[Mapping[str, Any]] = None,
      evaluation_kwargs: Optional[Mapping[str, Any]] = None,
      stopper_kwargs: Optional[Mapping[str, Any]] = None,
      n_trials: Optional[int] = 5,
      timeout: Optional[int] = 3600,
      metric: Optional[str] = "hits@10",
      direction: Optional[str] = "maximize",
      sampler: Optional[str] = "random",
      pruner: Optional[str] = "nop",
      metadata: Optional[Mapping] = None,
      save_artifacts: bool = True,
      move_to_cpu: bool = True,
      dry_run: bool = False,
      best_replicates: Optional[int] = None,
      discard_replicates: bool = False,
      create_unique_subdir: bool = False,
  ):
      """Run ablation study.
  
      :param datasets: A dataset name or list of dataset names.
      :param directory: The directory in which the experimental artifacts will be saved.
      :param models: A model name or list of model names.
      :param losses: A loss function name or list of loss function names.
      :param optimizers: An optimizer name or list of optimizer names.
      :param training_loops: A training loop name or list of training loop names.
      :param epochs: A quick way to set the ``num_epochs`` in the training kwargs.
      :param create_inverse_triples: Either a boolean for a single entry or a list of booleans.
      :param regularizers: A regularizer name, list of regularizer names, or None if no regularizer is desired.
      :param negative_sampler: A negative sampler name, list of regularizer names, or None if no negative sampler
          is desired. Negative sampling is used only in combination with :class:`pykeen.training.SLCWATrainingLoop`.
      :param evaluator: The name of the evaluator to be used. Defaults to rank-based evaluator.
      :param stopper: The name of the stopper to be used. Defaults to NopStopper which doesn't define a
          stopping criterion.
      :param model_to_model_kwargs: A mapping from model name to dictionaries of default keyword arguments for
          the instantiation of that model.
      :param model_to_model_kwargs_ranges: A mapping from model name to dictionaries of keyword argument
          ranges for that model to be used in HPO.
      :param model_to_loss_to_loss_kwargs: A mapping from model name to a mapping of loss name to a mapping
          of default keyword arguments for the instantiation of that loss function. This is useful because for some
          losses, have hyper-parameters such as :class:`pykeen.losses.MarginRankingLoss`.
      :param model_to_loss_to_loss_kwargs_ranges: A mapping from model name to a mapping of loss name
          to a mapping of keyword argument ranges for that loss to be used in HPO.
      :param model_to_optimizer_to_optimizer_kwargs: A mapping from model name to a mapping of optimizer name to a mapping
          of default keyword arguments for the instantiation of that optimizer. This is useful because the optimizers,
          have hyper-parameters such as the learning rate.
      :param model_to_optimizer_to_optimizer_kwargs_ranges: A mapping from model name to a mapping of optimizer name
          to a mapping of keyword argument ranges for that optimizer to be used in HPO.
      :param model_to_regularizer_to_regularizer_kwargs: A mapping from model name to a mapping of regularizer name to a
          mapping of default keyword arguments for the instantiation of that regularizer. This is useful because the
          optimizers, have hyper-parameters such as the regularization weight.
      :param model_to_regularizer_to_regularizer_kwargs_ranges: A mapping from model name to a mapping of regularizer name
          to a mapping of keyword argument ranges for that regularizer to be used in HPO.
      :param model_to_negative_sampler_to_negative_sampler_kwargs: A mapping from model name to a mapping of
          negative sampler name to a mapping of default keyword arguments for the instantiation of that negative sampler.
          This is useful because the negative samplers, have hyper-parameters such as the number of negatives that should
          get generated for each positive training example.
      :param model_to_negative_sampler_to_negative_sampler_kwargs_ranges: A mapping from model name to a mapping of
          negative sampler name to a mapping of keyword argument ranges for that negative sampler to be used in HPO.
      :param model_to_training_loop_to_training_loop_kwargs: A mapping from model name to a mapping of training loop name
          to a mapping of default keyword arguments for the training loop.
      :param model_to_training_loop_to_training_kwargs: A mapping from model name to a mapping of trainer name to a
          mapping of default keyword arguments for the training procedure. This is useful because you can set the
          hyper-parameters such as the number of training epochs and the batch size.
      :param model_to_training_loop_to_training_kwargs_ranges:  A mapping from model name to a mapping of
          trainer name to a mapping of keyword argument ranges for that trainer to be used in HPO.
      :param evaluator_kwargs: The keyword arguments passed to the evaluator.
      :param evaluation_kwargs: The keyword arguments passed during evaluation.
      :param stopper_kwargs: The keyword arguments passed to the stopper.
      :param n_trials: Number of HPO trials.
      :param timeout: The time (seconds) after which the ablation study will be terminated.
      :param metric: The metric to optimize during HPO.
      :param direction: Defines, whether to 'maximize' or 'minimize' the metric during HPO.
      :param sampler: The HPO sampler, it defaults to random search.
      :param pruner: Defines approach for pruning trials. Per default no pruning is used, i.e., pruner is
          set to 'Nopruner'.
      :param metadata: A mapping of meta data arguments such as name of the ablation study.
      :param save_artifacts: Defines, whether each trained model sampled during HPO should be saved.
      :param move_to_cpu: Defines, whether a replicate of the best model should be moved to CPU.
      :param dry_run: Defines whether only the configurations for the single experiments should be created without
          running them.
      :param best_replicates: Defines how often the final model should be re-trained and evaluated based on the best
          hyper-parameters enabling to measure the variance in performance.
      :param discard_replicates: Defines, whether the best model should be discarded after training and evaluation.
      :param create_unique_subdir: Defines, whether a unique sub-directory for the experimental artifacts should
          be created. The sub-directory name is defined  by the  current  data + a unique id.
      """
      directory = normalize_path(
          directory, *iter_unique_ids(disable=not create_unique_subdir)
      )
      directories = prepare_ablation(
          datasets=datasets,
          models=models,
          losses=losses,
          optimizers=optimizers,
          training_loops=training_loops,
          epochs=epochs,
          create_inverse_triples=create_inverse_triples,
          regularizers=regularizers,
          model_to_model_kwargs=model_to_model_kwargs,
          model_to_model_kwargs_ranges=model_to_model_kwargs_ranges,
          model_to_loss_to_loss_kwargs=model_to_loss_to_loss_kwargs,
          model_to_loss_to_loss_kwargs_ranges=model_to_loss_to_loss_kwargs_ranges,
          model_to_optimizer_to_optimizer_kwargs=model_to_optimizer_to_optimizer_kwargs,
          model_to_optimizer_to_optimizer_kwargs_ranges=model_to_optimizer_to_optimizer_kwargs_ranges,
          negative_sampler=negative_sampler,
          model_to_neg_sampler_to_neg_sampler_kwargs=model_to_negative_sampler_to_negative_sampler_kwargs,
          model_to_neg_sampler_to_neg_sampler_kwargs_ranges=model_to_negative_sampler_to_negative_sampler_kwargs_ranges,
          model_to_training_loop_to_training_loop_kwargs=model_to_training_loop_to_training_loop_kwargs,
          model_to_training_loop_to_training_kwargs=model_to_training_loop_to_training_kwargs,
          model_to_training_loop_to_training_kwargs_ranges=model_to_training_loop_to_training_kwargs_ranges,
          model_to_regularizer_to_regularizer_kwargs=model_to_regularizer_to_regularizer_kwargs,
          model_to_regularizer_to_regularizer_kwargs_ranges=model_to_regularizer_to_regularizer_kwargs_ranges,
          evaluator=evaluator,
          n_trials=n_trials,
          timeout=timeout,
          metric=metric,
          direction=direction,
          sampler=sampler,
          pruner=pruner,
          evaluator_kwargs=evaluator_kwargs,
          evaluation_kwargs=evaluation_kwargs,
          stopper=stopper,
          stopper_kwargs=stopper_kwargs,
          metadata=metadata,
          directory=directory,
          save_artifacts=save_artifacts,
      )
  
      _run_ablation_experiments(
          directories=directories,
          best_replicates=best_replicates,
          dry_run=dry_run,
          move_to_cpu=move_to_cpu,
          discard_replicates=discard_replicates,
      )
  
file_path: pykeen/src/pykeen/ablation/ablation.py
imports: import itertools
  import json
  import logging
  import pathlib
  import time
  from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
  from uuid import uuid4
  from ..training import SLCWATrainingLoop, training_loop_resolver
  from ..utils import normalize_path, normalize_string
label_desc: Use image node_id 1 for calling a global function with example usage: ablation_pipeline(datasets, directory, models, losses, optimizers, training_loops) without return types