code: def get_pred_from_proba(
      y_pred_proba: np.ndarray,
      problem_type: str = BINARY,
      decision_threshold: float = None,
  ) -> np.ndarray:
      if problem_type == BINARY:
          if decision_threshold is None:
              decision_threshold = 0.5
          # Using > instead of >= to align with Pandas `.idxmax` logic which picks the left-most column during ties.
          # If this is not done, then predictions can be inconsistent when converting in binary classification from multiclass-form pred_proba and
          # binary-form pred_proba when the pred_proba is 0.5 for positive and negative classes.
          if len(y_pred_proba.shape) == 2:
              assert y_pred_proba.shape[1] == 2
              # Assume positive class is in 2nd position
              y_pred = [
                  1 if pred > decision_threshold else 0
                  for pred in y_pred_proba[:, 1]
              ]
          else:
              y_pred = [
                  1 if pred > decision_threshold else 0
                  for pred in y_pred_proba
              ]
      elif problem_type == REGRESSION:
          y_pred = y_pred_proba
      elif problem_type == QUANTILE:
          y_pred = y_pred_proba
      else:
          y_pred = []
          if not len(y_pred_proba) == 0:
              y_pred = np.argmax(y_pred_proba, axis=1)
      return y_pred
  
imports: import logging
  import math
  import pickle
  import random
  import sys
  import time
  from typing import Callable, List, Tuple, Union
  import numpy
  import pandas
  import scipy.stats
  from numpy.typing import ArrayLike
  from pandas import DataFrame, Series
  from sklearn.model_selection import LeaveOneGroupOut, RepeatedKFold, RepeatedStratifiedKFold, train_test_split
  from autogluon.common.utils.resource_utils import ResourceManager
  from ..constants import BINARY, LARGE_DATA_THRESHOLD, MULTICLASS, MULTICLASS_UPPER_LIMIT, QUANTILE, REGRESS_THRESHOLD_LARGE_DATA, REGRESS_THRESHOLD_SMALL_DATA, REGRESSION, SOFTCLASS
  from ..metrics import Scorer, accuracy, pinball_loss, root_mean_squared_error
  from .miscs import warning_filter
label_desc: Use image node_id 10 for calling a global function with example usage: get_pred_from_proba(y_pred_proba, problem_type, decision_threshold) and returns: y_pred