Skip to content

Commit

Permalink
Allow None values in ModelCosineSimilarity evaluator.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 645424050
  • Loading branch information
tf-model-analysis-team authored and tfx-copybara committed Jun 21, 2024
1 parent 84a9c2b commit 807bd62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tensorflow_model_analysis/metrics/model_cosine_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def add_input(
model_name=self._baseline_model_name,
output_name=self._output_name,
flatten=False,
allow_none=False,
allow_none=True,
)
)

Expand All @@ -159,7 +159,7 @@ def add_input(
model_name=self._model_name,
output_name=self._output_name,
flatten=False,
allow_none=False,
allow_none=True,
)
)
accumulator.merge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def test_cosine_similarity(
examples = []
for baseline_prediction, candidate_prediction in prediction_pairs:
examples.append({
constants.LABELS_KEY: [0],
constants.LABELS_KEY: {
baseline_model_name: None,
candidate_model_name: None,
},
constants.PREDICTIONS_KEY: {
baseline_model_name: baseline_prediction,
candidate_model_name: candidate_prediction,
Expand Down

0 comments on commit 807bd62

Please sign in to comment.