Skip to content

Commit

Permalink
Change how the slice is stringified so it is easier to read.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
genehwung authored and Responsible ML Infra Team committed May 18, 2022
1 parent 0e109eb commit 495e3b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions fairness_indicators/example_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)

Expand All @@ -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['']['']
Expand Down

0 comments on commit 495e3b4

Please sign in to comment.