class_docstr: Tests that MutualInformation returns the correct AMI value.
class_docstr_tok: ["Tests","that","MutualInformation","returns","the","correct","AMI","value","."]
code: def test_mi_multivalent_too_large_int_value(self):
      label_array = pa.array([[0.1], [0.1], [0.1], [0.1], [0.1]])
      x = 2**53 + 1
      invalid_feat_array = pa.array([[x], [x], [x], [x], []])
      valid_feat_array = pa.array([[1], [1], [1], [1], []])
  
      batch = pa.RecordBatch.from_arrays(
          [label_array, invalid_feat_array, valid_feat_array],
          ["label_key", "invalid_feat_array", "valid_feat_array"],
      )
  
      schema = text_format.Parse(
          """
          feature {
            name: "invalid_feat_array"
            type: INT
            value_count {
              min: 0
              max: 2
            }
          }
          feature {
            name: "valid_feat_array"
            type: INT
            value_count {
              min: 0
              max: 2
            }
          }
          feature {
            name: "label_key"
            type: FLOAT
            shape {
              dim {
                size: 1
              }
            }
          }
          """,
          schema_pb2.Schema(),
      )
  
      # The value 2**53 + 1 is too large, and will cause np.histogram to fail.
      # We skip the feature if it cannot be encoded. We still encode the valid
      # features.
      expected = text_format.Parse(
          """
          features {
            custom_stats {
              name: "adjusted_mutual_information"
              num: 0.09617966939259784
            }
            path {
              step: "valid_feat_array"
            }
          }
      """,
          statistics_pb2.DatasetFeatureStatistics(),
      )
      self._assert_ami_output_equal(
          batch,
          expected,
          schema,
          types.FeaturePath(["label_key"]),
          allow_invalid_partitions=True,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import absltest
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import pyarrow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import mutual_information
  from tensorflow_data_validation.statistics.generators import partitioned_stats_generator
  from tensorflow_data_validation.utils import test_util
  from tfx_bsl.arrow import table_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 23 for calling the MutualInformationTest obj's underlying member method code with example usage: obj.test_mi_multivalent_too_large_int_value() without return types