code: def estimate_py_and_noise_matrices_from_probabilities(
      labels: np.ndarray,
      pred_probs: np.ndarray,
      *,
      thresholds: Optional[Union[np.ndarray, list]] = None,
      converge_latent_estimates: bool = True,
      py_method: str = "cnt",
      calibrate: bool = True,
  ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
      """Computes the confident counts
      estimate of latent variables `py` and the noise rates
      using observed labels and predicted probabilities, `pred_probs`.
  
      Important: this function assumes that `pred_probs` are out-of-sample
      holdout probabilities. This can be :ref:`done with cross validation <pred_probs_cross_val>`. If
      the probabilities are not computed out-of-sample, overfitting may occur.
  
      This function estimates the `noise_matrix` of shape ``(K, K)``. This is the
      fraction of examples in every class, labeled as every other class. The
      `noise_matrix` is a conditional probability matrix for ``P(label=k_s|true_label=k_y)``.
  
      Under certain conditions, estimates are exact, and in most
      conditions, estimates are within one percent of the actual noise rates.
  
      Parameters
      ----------
      labels : np.ndarray
        A 1D array of shape ``(N,)`` containing class labels for a standard (multi-class) classification dataset. Some given labels may be erroneous.
        Elements must be integers in the set 0, 1, ..., K-1, where K is the number of classes.
  
      pred_probs : np.ndarray
        Model-predicted class probabilities for each example in the dataset,
        in same format expected by :py:func:`filter.find_label_issues <cleanlab.filter.find_label_issues>` function.
  
      thresholds : array_like, optional
        An array of shape ``(K, 1)`` or ``(K,)`` of per-class threshold
        probabilities, used to determine the cutoff probability necessary to
        consider an example as a given class label (see `Northcutt et al.,
        2021 <https://jair.org/index.php/jair/article/view/12125>`_, Section
        3.1, Equation 2).
  
        This is for advanced users only. If not specified, these are computed
        for you automatically. If an example has a predicted probability
        greater than this threshold, it is counted as having true_label =
        k. This is not used for pruning/filtering, only for estimating the
        noise rates using confident counts.
  
      converge_latent_estimates : bool, optional
        If ``True``, forces numerical consistency of estimates. Each is estimated
        independently, but they are related mathematically with closed form
        equivalences. This will iteratively make them mathematically consistent.
  
      py_method : {"cnt", "eqn", "marginal", "marginal_ps"}, default="cnt"
        How to compute the latent prior ``p(true_label=k)``. Default is ``"cnt"`` as it often
        works well even when the noise matrices are estimated poorly by using
        the matrix diagonals instead of all the probabilities.
  
      calibrate : bool, default=True
        Calibrates confident joint estimate ``P(label=i, true_label=j)`` such that
        ``np.sum(cj) == len(labels)`` and ``np.sum(cj, axis = 1) == np.bincount(labels)``.
  
      Returns
      ------
      estimates : tuple
          A tuple of arrays: (`py`, `noise_matrix`, `inverse_noise_matrix`, `confident_joint`).
  
      Note
      ----
      Multi-label classification is not supported in this method.
      """
  
      confident_joint = compute_confident_joint(
          labels=labels,
          pred_probs=pred_probs,
          thresholds=thresholds,
          calibrate=calibrate,
      )
      assert isinstance(confident_joint, np.ndarray)
      py, noise_matrix, inv_noise_matrix = estimate_latent(
          confident_joint=confident_joint,
          labels=labels,
          py_method=py_method,
          converge_latent_estimates=converge_latent_estimates,
      )
      assert isinstance(confident_joint, np.ndarray)
  
      return py, noise_matrix, inv_noise_matrix, confident_joint
  
imports: from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import StratifiedKFold
  from sklearn.metrics import confusion_matrix
  import sklearn.base
  import numpy
  import warnings
  from typing import Tuple, Union, Optional
  from cleanlab.typing import LabelLike
  from cleanlab.internal.multilabel_utils import stack_complement, get_onehot_num_classes
  from cleanlab.internal.constants import TINY_VALUE, CONFIDENT_THRESHOLDS_LOWER_BOUND, FLOATING_POINT_COMPARISON
  from cleanlab.internal.util import value_counts_fill_missing_classes, clip_values, clip_noise_rates, round_preserving_row_totals, append_extra_datapoint, train_val_split, get_num_classes, get_unique_classes, is_torch_dataset, is_tensorflow_dataset
  from cleanlab.internal.latent_algebra import compute_inv_noise_matrix, compute_py, compute_noise_matrix_from_inverse
  from cleanlab.internal.validation import assert_valid_inputs, labels_to_array
label_desc: Use image node_id 11 for calling a global function with example usage: estimate_py_and_noise_matrices_from_probabilities(labels, pred_probs) and returns: py,  noise_matrix,  inv_noise_matrix,  confident_joint