def test_config(self): fbeta_obj = FBetaScore(num_classes=3, beta=0.5, average=None) self.assertEqual(fbeta_obj.beta, 0.5) self.assertEqual(fbeta_obj.average, None) self.assertEqual(fbeta_obj.num_classes, 3) self.assertEqual(fbeta_obj.dtype, tf.float32) # Check save and restore config fbeta_obj2 = FBetaScore.from_config(fbeta_obj.get_config()) self.assertEqual(fbeta_obj2.beta, 0.5) self.assertEqual(fbeta_obj2.average, None) self.assertEqual(fbeta_obj2.num_classes, 3) self.assertEqual(fbeta_obj2.dtype, tf.float32)
def test_config_fbeta(): fbeta_obj = FBetaScore(num_classes=3, beta=0.5, threshold=0.3, average=None) assert fbeta_obj.beta == 0.5 assert fbeta_obj.average is None assert fbeta_obj.threshold == 0.3 assert fbeta_obj.num_classes == 3 assert fbeta_obj.dtype == tf.float32 # Check save and restore config fbeta_obj2 = FBetaScore.from_config(fbeta_obj.get_config()) assert fbeta_obj2.beta == 0.5 assert fbeta_obj2.average is None assert fbeta_obj2.threshold == 0.3 assert fbeta_obj2.num_classes == 3 assert fbeta_obj2.dtype == tf.float32