class_docstr: Generates statistics for weighted features.
docstr: Populates and returns a stats proto containing custom stats.
  
  Args:
    accumulator: The final accumulator representing the global combine state.
  
  Returns:
    A DatasetFeatureStatistics proto.
docstr_tok: ["Populates","and","returns","a","stats","proto","containing","custom","stats",".","Args",":","accumulator",":","The","final","accumulator","representing","the","global","combine","state",".","Returns",":","A","DatasetFeatureStatistics","proto","."]
code: def extract_composite_output(
      self, accumulator: Dict[Text, Any]
  ) -> statistics_pb2.DatasetFeatureStatistics:
      """Populates and returns a stats proto containing custom stats.
  
      Args:
        accumulator: The final accumulator representing the global combine state.
  
      Returns:
        A DatasetFeatureStatistics proto.
      """
      result = statistics_pb2.DatasetFeatureStatistics()
      for weighted_feature in self._schema.weighted_feature:
          feature_result = result.features.add(
              path=types.FeaturePath([weighted_feature.name]).to_proto()
          )
          weight = types.FeaturePath.from_proto(
              weighted_feature.weight_feature
          )
          value = types.FeaturePath.from_proto(weighted_feature.feature)
          required_paths = [weight, value]
  
          weight_count_missing = accumulator[
              count_missing_generator.CountMissingGenerator.key(
                  weight, required_paths
              )
          ]
          feature_result.custom_stats.add(
              name=_MISSING_WEIGHT_NAME, num=weight_count_missing
          )
  
          value_count_missing = accumulator[
              count_missing_generator.CountMissingGenerator.key(
                  value, required_paths
              )
          ]
          feature_result.custom_stats.add(
              name=_MISSING_VALUE_NAME, num=value_count_missing
          )
  
          min_weight_length_diff, max_weight_length_diff = accumulator[
              length_diff_generator.LengthDiffGenerator.key(
                  weight, value, required_paths
              )
          ]
          feature_result.custom_stats.add(
              name=_MIN_WEIGHT_LENGTH_DIFF_NAME,
              num=min_weight_length_diff,
          )
          feature_result.custom_stats.add(
              name=_MAX_WEIGHT_LENGTH_DIFF_NAME,
              num=max_weight_length_diff,
          )
      return result
  
file_path: data-validation/tensorflow_data_validation/statistics/generators/weighted_feature_stats_generator.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.statistics.generators.constituents import count_missing_generator
  from tensorflow_data_validation.statistics.generators.constituents import length_diff_generator
  from typing import Any, Dict, Text
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 2 for calling the WeightedFeatureStatsGenerator obj's underlying member method code with example usage: obj.extract_composite_output(accumulator) and returns: result