{"record":{"id":"aff907a8d680c195","repo":"keras-team/keras","slug":"invalid-summation-method-argument-value-summat","errorCode":null,"errorMessage":"Invalid `summation_method` argument value \"{summation_method}\". Expected one of: {list(metrics_utils.AUCSummationMethod)}","messagePattern":"Invalid `summation_method` argument value \"(.+?)\"\\. Expected one of: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/metrics/confusion_metrics.py","lineNumber":1216,"sourceCode":"        num_labels=None,\n        label_weights=None,\n        from_logits=False,\n    ):\n        # Metric should be maximized during optimization.\n        self._direction = \"up\"\n\n        # Validate configurations.\n        if isinstance(curve, metrics_utils.AUCCurve) and curve not in list(\n            metrics_utils.AUCCurve\n        ):\n            raise ValueError(\n                f'Invalid `curve` argument value \"{curve}\". '\n                f\"Expected one of: {list(metrics_utils.AUCCurve)}\"\n            )\n        if isinstance(\n            summation_method, metrics_utils.AUCSummationMethod\n        ) and summation_method not in list(metrics_utils.AUCSummationMethod):\n            raise ValueError(\n                \"Invalid `summation_method` \"\n                f'argument value \"{summation_method}\". '\n                f\"Expected one of: {list(metrics_utils.AUCSummationMethod)}\"\n            )\n\n        # Update properties.\n        self._init_from_thresholds = thresholds is not None\n        if thresholds is not None:\n            # If specified, use the supplied thresholds.\n            self.num_thresholds = len(thresholds) + 2\n            thresholds = sorted(thresholds)\n            self._thresholds_distributed_evenly = (\n                metrics_utils.is_evenly_distributed_thresholds(\n                    np.array([0.0] + thresholds + [1.0])\n                )\n            )\n        else:\n            if num_thresholds <= 1:","sourceCodeStart":1198,"sourceCodeEnd":1234,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/metrics/confusion_metrics.py#L1198-L1234","documentation":"Raised by keras.metrics.AUC's __init__ when summation_method is an AUCSummationMethod enum instance outside the supported members ('interpolation', 'minoring', 'majoring' and friends). As with curve, only enum instances hit this check; strings are validated elsewhere.","triggerScenarios":"Passing an AUCSummationMethod enum from a different/older Keras or TF version, or a dynamically created enum instance, to keras.metrics.AUC(summation_method=...).","commonSituations":"Restored pickled configs across Keras upgrades; code copied between tensorflow.keras and standalone Keras.","solutions":["Use the string form: summation_method='interpolation'.","Import the enum from the same Keras installation if enums are required.","Avoid pickling enum objects inside training configs."],"exampleFix":"# before\nauc = keras.metrics.AUC(summation_method=old_tf_enum)\n\n# after\nauc = keras.metrics.AUC(summation_method='interpolation')","handlingStrategy":"validation","validationCode":"assert summation_method in ('interpolation', 'minoring', 'majoring'), summation_method","typeGuard":"def is_valid_summation(v) -> bool:\n    return v in ('interpolation', 'minoring', 'majoring')","tryCatchPattern":null,"preventionTips":["Use string literals in configs.","Re-import enums from the current Keras install when unavoidable."],"tags":["keras","metrics","auc","enum-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}