From 5d3d24233909ae10344f4e67afccc09076cdd0e1 Mon Sep 17 00:00:00 2001 From: Gene Hwung Date: Wed, 4 May 2022 16:17:02 -0700 Subject: [PATCH] Change how the slice is stringified so it is easier to read. From format of "FeatureA_X_FeatureB:ValueA_X_ValueB" to "FeautreA=ValueA; FeatureB=ValueB". For fairness indicator, the original behavir was kept. PiperOrigin-RevId: 446577668 --- RELEASE.md | 2 ++ fairness_indicators/example_model_test.py | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index d9364045..24125ae4 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -11,6 +11,8 @@ ## Bug Fixes and Other Changes ## Breaking Changes +* Changes how cross-slice is stringified for easier read: "FeatureA:ValueA__XX__FeatureB:ValueB" to "FeautreA=ValueA Vs. + FeatureB=ValueB". ## Deprecations diff --git a/fairness_indicators/example_model_test.py b/fairness_indicators/example_model_test.py index ea5150e7..3c2c627f 100644 --- a/fairness_indicators/example_model_test.py +++ b/fairness_indicators/example_model_test.py @@ -25,7 +25,6 @@ import six import tensorflow.compat.v1 as tf import tensorflow_model_analysis as tfma -from tensorflow_model_analysis.slicer import slicer_lib as slicer tf.compat.v1.enable_eager_execution() @@ -96,7 +95,7 @@ def test_example_model(self): FEATURE_MAP) expected_slice_keys = [ - 'Overall', 'slice:slice3', 'slice:slice1', 'slice:slice2' + 'Overall', 'slice=slice3', 'slice=slice1', 'slice=slice2' ] evaluation_results = tfma.load_eval_result(tfma_eval_result_path) @@ -105,7 +104,7 @@ def test_example_model(self): # Verify if false_positive_rate metrics are computed for all values of # slice. for (slice_key, metric_value) in evaluation_results.slicing_metrics: - slice_key = slicer.stringify_slice_key(slice_key) + slice_key = tfma.slicer.stringify_slice_key(slice_key) self.assertIn(slice_key, expected_slice_keys) self.assertGreaterEqual( 1.0, metric_value['']['']