code: def test_ood_predictions_scores():
      # Create and add OOD datapoint to test set
      X = data["X_test"]
      means = [[3, 2], [7, 7], [0, 8]]
      X_ood = np.array(means).mean(axis=0)
      X_with_ood = np.vstack([X, X_ood])
  
      y = data["true_labels_test"]
      y_with_ood = np.hstack([y, data["true_labels_train"][1]])
  
      # Fit Logistic Regression model on X_train and estimate pred_probs
      logreg = LogReg(multi_class="auto", solver="lbfgs")
      logreg.fit(data["X_train"], data["true_labels_train"])
      pred_probs = logreg.predict_proba(X_with_ood)
  
      ### Test non-adjusted OOD score logic
      (
          ood_predictions_scores_entropy,
          _,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          adjust_pred_probs=False,
      )
  
      # adjust pred probs should be False by default
      (
          ood_predictions_scores_least_confidence,
          _,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          method="least_confidence",
          adjust_pred_probs=False,
      )
  
      (
          ood_predictions_scores_gen,
          _,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          method="gen",
          adjust_pred_probs=False,
          M=3,  # Totally three classes
      )
  
      # check OOD scores calculated correctly
      assert (
          1.0 - get_normalized_entropy(pred_probs)
          == ood_predictions_scores_entropy
      ).all()
      assert (
          pred_probs.max(axis=1)
          == ood_predictions_scores_least_confidence
      ).all()
      assert ood_predictions_scores_gen.max() < 1
      assert ood_predictions_scores_gen.min() > 0
      assert np.where(
          np.sort(ood_predictions_scores_entropy)
          == ood_predictions_scores_entropy[-1]
      )[0] < 0.02 * len(ood_predictions_scores_entropy)
      assert np.where(
          np.sort(ood_predictions_scores_least_confidence)
          == ood_predictions_scores_least_confidence[-1]
      )[0] < 0.02 * len(ood_predictions_scores_least_confidence)
      assert np.where(
          np.sort(ood_predictions_scores_gen)
          == ood_predictions_scores_gen[-1]
      )[0] < 0.02 * len(ood_predictions_scores_gen)
  
      ### Test adjusted OOD score logic
      (
          ood_predictions_scores_adj_entropy,
          confident_thresholds_adj_entropy,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          labels=y_with_ood,
          adjust_pred_probs=True,
          method="entropy",
      )
  
      (
          ood_predictions_scores_adj_least_confidence,
          confident_thresholds_adj_least_confidence,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          labels=y_with_ood,
          adjust_pred_probs=True,
          method="least_confidence",
      )
  
      # test confident thresholds calculated correctly
      confident_thresholds = get_confident_thresholds(
          labels=y_with_ood, pred_probs=pred_probs, multi_label=False
      )
  
      assert (
          confident_thresholds == confident_thresholds_adj_entropy
      ).all()
      assert (
          confident_thresholds_adj_least_confidence
          == confident_thresholds_adj_entropy
      ).all()
  
      # check adjusted OOD scores different from non adjust OOD scores
      assert not (
          ood_predictions_scores_adj_entropy
          == ood_predictions_scores_entropy
      ).all()
      assert not (
          ood_predictions_scores_adj_least_confidence
          == ood_predictions_scores_least_confidence
      ).all()
  
      ### Test pre-calculated confident thresholds logic
      (
          ood_predictions_scores_2,
          confident_thresholds_2,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          confident_thresholds=confident_thresholds,
          adjust_pred_probs=True,
      )
  
      assert (confident_thresholds_2 == confident_thresholds).all()
      assert (
          ood_predictions_scores_2 == ood_predictions_scores_adj_entropy
      ).all()
  
      # test using labels list type works
      y_with_ood_list = y_with_ood.tolist()
      (
          ood_predictions_scores_adj_entropy_list,
          confident_thresholds_adj_entropy_list,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          labels=y_with_ood_list,
          adjust_pred_probs=True,
          method="entropy",
      )
  
      # test using labels series type works
      y_with_ood_series = pd.Series(y_with_ood)
      (
          ood_predictions_scores_adj_entropy_series,
          confident_thresholds_adj_entropy_series,
      ) = outlier._get_ood_predictions_scores(
          pred_probs=pred_probs,
          labels=y_with_ood_series,
          adjust_pred_probs=True,
          method="entropy",
      )
  
      assert (
          confident_thresholds_adj_entropy_list
          == confident_thresholds_adj_entropy
      ).all()
      assert (
          confident_thresholds_adj_entropy_series
          == confident_thresholds_adj_entropy
      ).all()
  
imports: import numpy
  import pandas
  import pytest
  from cleanlab.benchmarking.noise_generation import generate_noise_matrix_from_trace
  from cleanlab.benchmarking.noise_generation import generate_noisy_labels
  from cleanlab import count, outlier
  from cleanlab.count import get_confident_thresholds
  from cleanlab.outlier import OutOfDistribution
  from cleanlab.internal.label_quality_utils import get_normalized_entropy
  from sklearn.neighbors import NearestNeighbors
  from sklearn.linear_model import LogisticRegression
label_desc: Use image node_id 9 for calling a global function with example usage: test_ood_predictions_scores() without return types