code: def test_f_beta_1_is_f_1():
      # test that putting beta to 1 indeed finds the best threshold to optimize
      # the f1_score
      rng = np.random.RandomState(42)
      n_samples = 100
      pairs, y = rng.randn(n_samples, 2, 5), rng.choice(
          [-1, 1], size=n_samples
      )
      pairs_learner = IdentityPairsClassifier()
      pairs_learner.fit(pairs, y)
      pairs_learner.calibrate_threshold(
          pairs, y, strategy="f_beta", beta=1
      )
      best_f1_score = f1_score(y, pairs_learner.predict(pairs))
      for threshold in -pairs_learner.decision_function(pairs):
          pairs_learner.set_threshold(threshold)
          assert (
              f1_score(y, pairs_learner.predict(pairs)) <= best_f1_score
          )
  
imports: from functools import partial
  import pytest
  from numpy.testing import assert_array_equal
  from scipy.spatial.distance import euclidean
  from metric_learn.base_metric import _PairsClassifierMixin, MahalanobisMixin
  from sklearn.exceptions import NotFittedError
  from sklearn.metrics import f1_score, accuracy_score, fbeta_score, precision_score
  from sklearn.model_selection import train_test_split
  from test.test_utils import pairs_learners, ids_pairs_learners
  from metric_learn.sklearn_shims import set_random_state
  from sklearn import clone
  import numpy
  from itertools import product
label_desc: Use image node_id 9 for calling a global function with example usage: test_f_beta_1_is_f_1() without return types