code: def test_cv_protoselect_euclidean(
      n_classes,
      use_protos,
      use_valset,
      num_prototypes,
      eps_grid,
      quantiles,
      grid_size,
      n_splits,
      batch_size,
  ):
      """
      Unit test for cross-validation. Checks if all parameters are passed correctly and checks the
      appropriate behavior when the validation is passed or omitted.
      """
      X_train, y_train = make_classification(
          n_samples=1000,
          n_features=n_classes,
          n_informative=n_classes,
          n_redundant=0,
          n_repeated=0,
          n_classes=n_classes,
          n_clusters_per_class=1,
          class_sep=10,
          random_state=0,
      )
  
      # construct datasets
      if use_valset:
          X_train, X_val, y_train, y_val = train_test_split(
              X_train, y_train, test_size=0.2, random_state=0
          )
          trainset = (X_train, y_train)
          protoset = (X_train,) if use_protos else None
          valset = (X_val, y_val)
      else:
          trainset = (X_train, y_train)
          protoset = (X_train,) if use_protos else None
          valset = None
  
      cv = cv_protoselect_euclidean(
          trainset=trainset,
          protoset=protoset,
          valset=valset,
          num_prototypes=num_prototypes,
          eps_grid=eps_grid,
          quantiles=quantiles,
          grid_size=grid_size,
          kfold_kw={"n_splits": n_splits},
          protoselect_kw={"batch_size": batch_size},
      )
  
      if use_valset:
          # check if the `scores` shape is 1D when validation set is passed
          assert cv["meta"]["scores"].shape == (
              len(cv["meta"]["eps_grid"]),
              1,
          )
      else:
          # check if the `scores` shape is 2D when no validation is passed
          assert cv["meta"]["scores"].shape == (
              len(cv["meta"]["eps_grid"]),
              n_splits,
          )
  
      if eps_grid is not None:
          # if `eps_grid` is provided, the check that the `best_eps` is amongst `eps_grid` values.
          assert np.any(np.isclose(eps_grid, cv["best_eps"]))
      else:
          # if `eps_grid` is not provided, check that the search interval was split in `grid_size` bins
          assert len(cv["meta"]["eps_grid"]) == grid_size
  
imports: from copy import deepcopy
  import matplotlib
  import numpy
  import pytest
  from sklearn.datasets import make_classification
  from sklearn.model_selection import train_test_split
  from alibi.api.defaults import DEFAULT_DATA_PROTOSELECT, DEFAULT_META_PROTOSELECT
  from alibi.api.interfaces import Explanation
  from alibi.prototypes import ProtoSelect
  from alibi.prototypes.protoselect import _batch_preprocessing, _imscatterplot, compute_prototype_importances, cv_protoselect_euclidean, visualize_image_prototypes
  from alibi.utils.kernel import EuclideanDistance
label_desc: Use image node_id 2 for calling a global function with example usage: test_cv_protoselect_euclidean(n_classes, use_protos, use_valset, num_prototypes, eps_grid, quantiles, grid_size, n_splits, batch_size) without return types