code: def test_various_scoring_on_tuples_learners(
      estimator, build_dataset, with_preprocessor
  ):
      """Tests that scikit-learn's scoring returns something finite,
      for other scoring than default scoring. (List of scikit-learn's scores can be
      found in sklearn.metrics._scorer). For each type of output (predict,
      predict_proba, decision_function), we test a bunch of scores.
      We only test on pairs learners because quadruplets don't have a y argument.
      """
      input_data, labels, preprocessor, _ = build_dataset(
          with_preprocessor
      )
      estimator = clone(estimator)
      estimator.set_params(preprocessor=preprocessor)
      set_random_state(estimator)
  
      # scores that need a predict function: every tuples learner should have a
      # predict function (whether the pair is of positive samples or negative
      # samples)
      for scoring in ["accuracy", "f1"]:
          check_score_is_finite(scoring, estimator, input_data, labels)
      # scores that need a predict_proba:
      if hasattr(estimator, "predict_proba"):
          for scoring in ["neg_log_loss", "brier_score"]:
              check_score_is_finite(
                  scoring, estimator, input_data, labels
              )
      # scores that need a decision_function: every tuples learner should have a
      # decision function (the metric between points)
      for scoring in [
          "roc_auc",
          "average_precision",
          "precision",
          "recall",
      ]:
          check_score_is_finite(scoring, estimator, input_data, labels)
  
imports: import pytest
  import unittest
  from sklearn.utils.estimator_checks import check_estimator
  from sklearn.base import TransformerMixin
  from sklearn.pipeline import make_pipeline
  from sklearn.utils import check_random_state
  from metric_learn.sklearn_shims import assert_allclose_dense_sparse, set_random_state, _get_args, is_public_parameter, get_scorer
  from metric_learn import Covariance, LFDA, LMNN, MLKR, NCA, ITML_Supervised, LSML_Supervised, MMC_Supervised, RCA_Supervised, SDML_Supervised, SCML_Supervised
  from sklearn import clone
  import numpy
  from sklearn.model_selection import cross_val_score, cross_val_predict, train_test_split, KFold
  from test.test_utils import metric_learners, ids_metric_learners, mock_preprocessor, tuples_learners, ids_tuples_learners, pairs_learners, ids_pairs_learners, remove_y, metric_learners_pipeline, ids_metric_learners_pipeline
label_desc: Use image node_id 3 for calling a global function with example usage: test_various_scoring_on_tuples_learners(estimator, build_dataset, with_preprocessor) without return types