class_docstr: A helper class that contains methods to for privacy utility analysis.
docstr: Generates sampled outputs of the input data according to sample parameters.
  
  The sampling is by partitions. e.g. a certain amount of partitions_keys are
  selected and the output contains all records with these partition_keys.
  
  Args:
    input_data: The data to sample. It can be local data, beam PCollection or
      Spark RDD depending on the engine used.
    params: The parameters defining sampling properties.
    data_extractors: A function to extract privacy_id, partition_key, value of
      the input data.
  
  Returns:
    Sampled output containing tuple of (privacy_id, partition_key, value).
code: def sample(
      self,
      input_data: DataType,
      params: SampleParams,
      data_extractors: pipeline_dp.DataExtractors,
  ) -> DataType:
      """Generates sampled outputs of the input data according to sample parameters.
  
      The sampling is by partitions. e.g. a certain amount of partitions_keys are
      selected and the output contains all records with these partition_keys.
  
      Args:
        input_data: The data to sample. It can be local data, beam PCollection or
          Spark RDD depending on the engine used.
        params: The parameters defining sampling properties.
        data_extractors: A function to extract privacy_id, partition_key, value of
          the input data.
  
      Returns:
        Sampled output containing tuple of (privacy_id, partition_key, value).
      """
  
      col = self._be.map(
          input_data,
          functools.partial(_extract_fn, data_extractors),
          "Extract (privacy_id, partition_key, value))",
      )
      # col : (privacy_id, partition_key, value)
      col = self._be.map_tuple(
          col,
          lambda pid, pk, v: (pk, (pid, v)),
          "Rekey to (partition_key, (privacy_id, value))",
      )
      # col : (partition_key, (privacy_id, value))
      # Sample the data.
      # group by key, filter keys by sampling, expand the values by flat map
      col = self._be.group_by_key(col, "Group by pk")
      col = self._be.map_tuple(
          col,
          lambda pk, pid_v_seq: (1, (pk, pid_v_seq)),
          "Rekey to (1, (pk, pid_v_seq))",
      )
      col = self._be.sample_fixed_per_key(
          col, params.number_of_sampled_partitions, "Sample partitions"
      )
      col = self._be.flat_map(col, lambda plst: plst[1], "")
  
      def expand_fn(pk_pidandvseq: DataType):
          pk, pid_pv_seq = pk_pidandvseq
          return [(pid, pk, v) for pid, v in pid_pv_seq]
  
      col = self._be.flat_map(
          col, expand_fn, "Transform to (pid, pk, value)"
      )
      return col
  
file_path: pipelinedp/utility_analysis/data_peeker.py
imports: import dataclasses
  import functools
  from typing import Any, Sequence, Union, Optional, Tuple
  import pipeline_dp
  from utility_analysis import non_private_combiners
label_desc: Use image node_id 3 for calling the DataPeeker obj's underlying member method code with example usage: obj.sample(input_data, params, data_extractors) and returns: col, unknown