code: def remove_noise_from_class(
      noise_matrix, class_without_noise
  ) -> np.ndarray:
      """A helper function in the setting of PU learning.
      Sets all P(label=class_without_noise|true_label=any_other_class) = 0
      in noise_matrix for pulearning setting, where we have
      generalized the positive class in PU learning to be any
      class of choosing, denoted by class_without_noise.
  
      Parameters
      ----------
      noise_matrix : np.ndarray of shape (K, K), K = number of classes
          A conditional probability matrix of the form P(label=k_s|true_label=k_y) containing
          the fraction of examples in every class, labeled as every other class.
          Assumes columns of noise_matrix sum to 1.
  
      class_without_noise : int
          Integer value of the class that has no noise. Traditionally,
          this is 1 (positive) for PU learning."""
  
      # Number of classes
      K = len(noise_matrix)
  
      cwn = class_without_noise
      x = np.copy(noise_matrix)
  
      # Set P( labels = cwn | y != cwn) = 0 (no noise)
      x[cwn, [i for i in range(K) if i != cwn]] = 0.0
  
      # Normalize columns by increasing diagonal terms
      # Ensures noise_matrix is a valid probability matrix
      for i in range(K):
          x[i][i] = 1 - float(np.sum(x[:, i]) - x[i][i])
  
      return x
  
imports: import warnings
  import numpy
  import pandas
  from typing import Union, Tuple
  from cleanlab.typing import DatasetLike, LabelLike
  from cleanlab.internal.validation import labels_to_array
  from cleanlab.internal.constants import FLOATING_POINT_COMPARISON, TINY_VALUE
label_desc: Use image node_id 1 for calling a global function with example usage: remove_noise_from_class(noise_matrix, class_without_noise) and returns: x