code: def run_membership_probability_analysis(
      attack_input: AttackInputData, slicing_spec: SlicingSpec = None
  ) -> MembershipProbabilityResults:
      """Perform membership probability analysis on all given slice types.
  
      Args:
        attack_input: input data for compute membership probabilities
        slicing_spec: specifies attack_input slices
  
      Returns:
        the membership probability results.
      """
      attack_input.validate()
      membership_prob_results = []
  
      if slicing_spec is None:
          slicing_spec = SlicingSpec(entire_dataset=True)
      num_classes = None
      if slicing_spec.by_class:
          num_classes = attack_input.num_classes
      input_slice_specs = get_single_slice_specs(
          slicing_spec, num_classes
      )
      for single_slice_spec in input_slice_specs:
          attack_input_slice = get_slice(
              attack_input, single_slice_spec
          )
          membership_prob_results.append(
              _compute_membership_probability(attack_input_slice)
          )
  
      return MembershipProbabilityResults(
          membership_prob_results=membership_prob_results
      )
  
imports: import logging
  from typing import Iterable, List, Optional, Union
  import numpy
  from scipy import special
  from sklearn import metrics
  from sklearn import model_selection
  from tensorflow_privacy.privacy.privacy_tests import epsilon_lower_bound
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import models
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResults
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import DataSize
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EPSILON_ALPHA
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EPSILON_K
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EPSILON_METHODS
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EpsilonLowerBoundValue
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import MembershipProbabilityResults
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import PrivacyReportMetadata
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import RocCurve
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleAttackResult
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleMembershipProbabilityResult
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleSliceSpec
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingSpec
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.dataset_slicing import get_single_slice_specs
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.dataset_slicing import get_slice
label_desc: Use image node_id 8 for calling a global function with example usage: run_membership_probability_analysis(attack_input, slicing_spec) and returns: MembershipProbabilityResults