class_docstr: Estimates custom statistics in a non-streaming fashion.
  
  A TransformStatsGenerator which partitions the input data and calls the user
  specified stats_fn over each partition. Meta-statistics are calculated over
  the statistics returned by stats_fn to estimate the true value of the
  statistic. For invalid feature values, the worker computing PartitionedStatsFn
  over a partition may "gracefully fail" and not report that statistic (refer to
  PartitionedStatsFn for more information). Meta-statistics for a feature are
  only calculated if the number of partitions where the statistic is computed
  exceeds a configurable threshold.
  
  A large number of examples in a partition may result in worker OOM errors.
  This can be prevented by setting max_examples_per_partition.
class_docstr_tok: ["Estimates","custom","statistics","in","a","non-streaming","fashion",".","A","TransformStatsGenerator","which","partitions","the","input","data","and","calls","the","user","specified","stats_fn","over","each","partition",".","Meta-statistics","are","calculated","over","the","statistics","returned","by","stats_fn","to","estimate","the","true","value","of","the","statistic",".","For","invalid","feature","values",",","the","worker","computing","PartitionedStatsFn","over","a","partition","may","``","gracefully","fail","''","and","not","report","that","statistic","(","refer","to","PartitionedStatsFn","for","more","information",")",".","Meta-statistics","for","a","feature","are","only","calculated","if","the","number","of","partitions","where","the","statistic","is","computed","exceeds","a","configurable","threshold",".","A","large","number","of","examples","in","a","partition","may","result","in","worker","OOM","errors",".","This","can","be","prevented","by","setting","max_examples_per_partition","."]
docstr: Initializes NonStreamingCustomStatsGenerator.
  
  Args:
    stats_fn: The PartitionedStatsFn that will be run on each sample.
    num_partitions: The number of partitions the stat will be calculated on.
    min_partitions_stat_presence: The minimum number of partitions a stat
      computation must succeed in for the result to be returned.
    seed: An int used to seed the numpy random number generator.
    max_examples_per_partition: An integer used to specify the maximum
      number of examples per partition to limit memory usage in a worker. If
      the number of examples per partition exceeds this value, the examples
      are randomly selected.
    batch_size: Number of examples per input batch.
    name: An optional unique name associated with the statistics generator.
docstr_tok: ["Initializes","NonStreamingCustomStatsGenerator",".","Args",":","stats_fn",":","The","PartitionedStatsFn","that","will","be","run","on","each","sample",".","num_partitions",":","The","number","of","partitions","the","stat","will","be","calculated","on",".","min_partitions_stat_presence",":","The","minimum","number","of","partitions","a","stat","computation","must","succeed","in","for","the","result","to","be","returned",".","seed",":","An","int","used","to","seed","the","numpy","random","number","generator",".","max_examples_per_partition",":","An","integer","used","to","specify","the","maximum","number","of","examples","per","partition","to","limit","memory","usage","in","a","worker",".","If","the","number","of","examples","per","partition","exceeds","this","value",",","the","examples","are","randomly","selected",".","batch_size",":","Number","of","examples","per","input","batch",".","name",":","An","optional","unique","name","associated","with","the","statistics","generator","."]
code: def __init__(
      self,
      stats_fn: PartitionedStatsFn,
      num_partitions: int,
      min_partitions_stat_presence: int,
      seed: int,
      max_examples_per_partition: int,
      batch_size: int = 1000,
      name: Text = "NonStreamingCustomStatsGenerator",
  ) -> None:
      """Initializes NonStreamingCustomStatsGenerator.
  
      Args:
        stats_fn: The PartitionedStatsFn that will be run on each sample.
        num_partitions: The number of partitions the stat will be calculated on.
        min_partitions_stat_presence: The minimum number of partitions a stat
          computation must succeed in for the result to be returned.
        seed: An int used to seed the numpy random number generator.
        max_examples_per_partition: An integer used to specify the maximum
          number of examples per partition to limit memory usage in a worker. If
          the number of examples per partition exceeds this value, the examples
          are randomly selected.
        batch_size: Number of examples per input batch.
        name: An optional unique name associated with the statistics generator.
      """
  
      super(NonStreamingCustomStatsGenerator, self).__init__(
          name=name,
          ptransform=_GenerateNonStreamingCustomStats(
              stats_fn=stats_fn,
              num_partitions=num_partitions,
              min_partitions_stat_presence=min_partitions_stat_presence,
              seed=seed,
              max_examples_per_partition=max_examples_per_partition,
              batch_size=batch_size,
              name=name,
          ),
      )
  
imports: import collections
  import functools
  from typing import Dict, Iterable, Text, Tuple
  import apache_beam
  import numpy
  import pyarrow
  from tensorflow_data_validation import constants
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.utils import stats_util
  from tfx_bsl.arrow import table_util
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 1 to create a new NonStreamingCustomStatsGenerator object from inherited base classes: stats_generator with example: obj = NonStreamingCustomStatsGenerator(stats_fn, num_partitions, min_partitions_stat_presence, seed, max_examples_per_partition, batch_size, name)