class_docstr: A combiner statistics generator that computes cross feature statistics.
    
class_docstr_tok: ["A","combiner","statistics","generator","that","computes","cross","feature","statistics","."]
code: def extract_output(
      self, accumulator: CrossFeatureStatsGeneratorAccumulator
  ) -> statistics_pb2.DatasetFeatureStatistics:
      # Create a new DatasetFeatureStatistics proto.
      result = statistics_pb2.DatasetFeatureStatistics()
  
      for feat_cross, cross_feat_stats in accumulator.items():
          # Construct the CrossFeatureStatistics proto from the partial
          # cross feature stats.
          cross_feat_stats_proto = result.cross_features.add()
          path_x = path_pb2.Path()
          path_x.step.append(feat_cross[0])
          path_y = path_pb2.Path()
          path_y.step.append(feat_cross[1])
          cross_feat_stats_proto.path_x.CopyFrom(path_x)
          cross_feat_stats_proto.path_y.CopyFrom(path_y)
          cross_feat_stats_proto.count = cross_feat_stats.count
          if cross_feat_stats.count > 0:
              num_cross_stats_proto = (
                  statistics_pb2.NumericCrossStatistics()
              )
              covariance = (
                  cross_feat_stats.sum_xy / cross_feat_stats.count
              ) - (cross_feat_stats.sum_x / cross_feat_stats.count) * (
                  cross_feat_stats.sum_y / cross_feat_stats.count
              )
              num_cross_stats_proto.covariance = covariance
              std_dev_x = math.sqrt(
                  max(
                      0,
                      (
                          cross_feat_stats.sum_square_x
                          / cross_feat_stats.count
                      )
                      - math.pow(
                          cross_feat_stats.sum_x
                          / cross_feat_stats.count,
                          2,
                      ),
                  )
              )
              std_dev_y = math.sqrt(
                  max(
                      0,
                      (
                          cross_feat_stats.sum_square_y
                          / cross_feat_stats.count
                      )
                      - math.pow(
                          cross_feat_stats.sum_y
                          / cross_feat_stats.count,
                          2,
                      ),
                  )
              )
              if std_dev_x != 0 and std_dev_y != 0:
                  correlation = covariance / (std_dev_x * std_dev_y)
                  num_cross_stats_proto.correlation = correlation
              cross_feat_stats_proto.num_cross_stats.CopyFrom(
                  num_cross_stats_proto
              )
  
      return result
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  import math
  import random
  from typing import Dict, Iterable, List, Optional, Text
  import numpy
  import pandas
  from pandas import DataFrame, Series
  import pyarrow
  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 array_util
  from tensorflow_metadata.proto.v0 import path_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 6 for calling the CrossFeatureStatsGenerator obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: result