From 190497c93420ee1762565bca1cf409c21ce65c79 Mon Sep 17 00:00:00 2001 From: yclian0528 Date: Mon, 16 Dec 2024 23:11:35 +0800 Subject: [PATCH] fix: correct `metrics` argument format in model.compile Resolved a ValueError caused by passing a single metric object to the `metrics` argument of `model.compile`. Updated it to a list containing `tf.keras.metrics.BinaryAccuracy` to comply with Keras requirements. Error message: ValueError: Expected `metrics` argument to be a list, tuple, or dict. --- .../dp_auditorium/dp_auditorium/testers/hockey_stick_tester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/dp_auditorium/dp_auditorium/testers/hockey_stick_tester.py b/python/dp_auditorium/dp_auditorium/testers/hockey_stick_tester.py index a8b6bbc7..1b61eaea 100644 --- a/python/dp_auditorium/dp_auditorium/testers/hockey_stick_tester.py +++ b/python/dp_auditorium/dp_auditorium/testers/hockey_stick_tester.py @@ -193,7 +193,7 @@ def _get_optimized_divergence_estimation_model( self._training_options.optimizer_learning_rate ), loss=tf.keras.losses.BinaryCrossentropy(from_logits=True), - metrics=tf.keras.metrics.BinaryAccuracy(threshold=0.0), + metrics=[tf.keras.metrics.BinaryAccuracy(threshold=0.0)], ) features, labels = self._generate_inputs_to_model( samples_first_distribution,