class_docstr: Computes Mutual Information(MI) between each feature and the label.
  
  The non-streaming sk-learn implementation of MI is used to
  estimate Adjusted Mutual Information(AMI) and MI between all valid features
  and the label. AMI prevents overestimation of MI for high entropy features.
  It is defined as MI(feature, labels) - MI(feature, np.random.shuffle(labels)).
  
  SkLearnMutualInformation will "gracefully fail" on all features
  that are multivalent since they are not supported by sk-learn. The compute
  method will not report statistics for these invalid features.
docstr: Computes MI and AMI between all valid features and labels.
  
  Args:
    examples: Arrow RecordBatch containing a batch of examples.
  
  Returns:
    DatasetFeatureStatistics proto containing AMI and MI for each valid
      feature in the dataset. Some features may filtered out by
      _remove_unsupported_feature_columns if they are inavlid. In this case,
      AMI and MI will not be calculated for the invalid feature.
  
  Raises:
    ValueError: If label_feature contains unsupported data.
docstr_tok: ["Computes","MI","and","AMI","between","all","valid","features","and","labels",".","Args",":","examples",":","Arrow","RecordBatch","containing","a","batch","of","examples",".","Returns",":","DatasetFeatureStatistics","proto","containing","AMI","and","MI","for","each","valid","feature","in","the","dataset",".","Some","features","may","filtered","out","by","_remove_unsupported_feature_columns","if","they","are","inavlid",".","In","this","case",",","AMI","and","MI","will","not","be","calculated","for","the","invalid","feature",".","Raises",":","ValueError",":","If","label_feature","contains","unsupported","data","."]
code: def compute(
      self, examples: pa.RecordBatch
  ) -> statistics_pb2.DatasetFeatureStatistics:
      """Computes MI and AMI between all valid features and labels.
  
      Args:
        examples: Arrow RecordBatch containing a batch of examples.
  
      Returns:
        DatasetFeatureStatistics proto containing AMI and MI for each valid
          feature in the dataset. Some features may filtered out by
          _remove_unsupported_feature_columns if they are inavlid. In this case,
          AMI and MI will not be calculated for the invalid feature.
  
      Raises:
        ValueError: If label_feature contains unsupported data.
      """
      examples = self._remove_unsupported_feature_columns(
          examples, self._schema
      )
  
      flattened_examples = _flatten_and_impute(
          examples, self._categorical_features
      )
      if self._label_feature not in flattened_examples:
          raise ValueError("Label column contains unsupported data.")
      labels = flattened_examples.pop(self._label_feature)
      df = pd.DataFrame(flattened_examples)
      # Boolean list used to mark features as discrete for sk-learn MI computation
      discrete_feature_mask = (
          self._convert_categorical_features_to_numeric(df)
      )
      return stats_util.make_dataset_feature_stats_proto(
          self._calculate_mi(
              df, labels, discrete_feature_mask, seed=self._seed
          )
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  from typing import Dict, List, Optional, Sequence, Set, Text, Union
  import numpy
  import pandas
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.arrow import arrow_util
  from tensorflow_data_validation.statistics.generators import partitioned_stats_generator
  from tensorflow_data_validation.utils import schema_util
  from tensorflow_data_validation.utils import stats_util
  from tfx_bsl.arrow import array_util
  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 SkLearnMutualInformation obj's underlying member method code with example usage: obj.compute(examples) and returns: stats_util